Xceed Toolkit Plus for WPF v5.0 Documentation
Xceed.Wpf.ListBox Assembly / Xceed.Wpf.ListBox Namespace / ListBox Class / BeginGetSelectedItems Method
The AsyncCallback delegate to be called when the operation is complete.
An object containing state information for the operation.
Example


In This Topic
    BeginGetSelectedItems Method
    In This Topic
    Begins the asynchronous retrieval of the selected items.
    Syntax
    'Declaration
     
    Public Function BeginGetSelectedItems( _
       ByVal callback As AsyncCallback, _
       ByVal asyncState As Object _
    ) As IAsyncResult
    'Usage
     
    Dim instance As ListBox
    Dim callback As AsyncCallback
    Dim asyncState As Object
    Dim value As IAsyncResult
     
    value = instance.BeginGetSelectedItems(callback, asyncState)
    public IAsyncResult BeginGetSelectedItems( 
       AsyncCallback callback,
       object asyncState
    )

    Parameters

    callback
    The AsyncCallback delegate to be called when the operation is complete.
    asyncState
    An object containing state information for the operation.

    Return Value

    An IAsyncResult representing the result of the operation.
    Remarks
    When working with a source that is not data-virtualized (asynchronous), use SelectedItems instead.
    Example
    Private Sub GetSelectedItems()
       Dim result As IAsyncResult = Me.sllbListBox.BeginGetSelectedItems( New AsyncCallback( AddressOf Me.ProcessSelectedItems ), Nothing )
       If( result.IsCompleted ) Then
          Dim selectedItems As IEnumerable( Of Object ) = Me.sllbListBox.EndGetSelectedItems( result )
       End If
    End Sub
     
    Private Sub ProcessSelectedItems( ByVal result As IAsyncResult )
       If( result.CompletedSynchronously ) Then
          Return
       End If
       Dim selectedItems As IEnumerable( Of Object )  = Me.sllbListBox.EndGetSelectedItems( result )
    End Sub
    private void GetSelectedItems()
    {
       IAsyncResult result = this.sllbListBox.BeginGetSelectedItems( new AsyncCallback( this.ProcessSelectedItems ), null );
       if( result.IsCompleted )
          IEnumerable<object> selectedItems = this.sllbListBox.EndGetSelectedItems( result );
    }
     
    private void ProcessSelectedItems( IAsyncResult result )
    {
       if( result.CompletedSynchronously )
          return;
       IEnumerable<object> selectedItems = this.sllbListBox.EndGetSelectedItems( result );
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also