Xceed Toolkit Plus for WPF v5.0 Documentation
Xceed.Wpf.ListBox Assembly / Xceed.Wpf.ListBox Namespace / ListBox Class / SelectedItem Property


In This Topic
    SelectedItem Property (ListBox)
    In This Topic
    Gets or sets the first item in the current selection or returns null if the selection is empty.
    Syntax
    'Declaration
     
    Public Property SelectedItem As Object
    'Usage
     
    Dim instance As ListBox
    Dim value As Object
     
    instance.SelectedItem = value
     
    value = instance.SelectedItem
    public object SelectedItem {get; set;}

    Property Value

    The first item in the current selection or null if the selection is empty.
    Remarks

    When used with a data-virtualized (asynchronous) source, this property will always return null; use BeginGetSelectedItems and EndGetSelectedItems instead.

    Returns null if nothing is selected or if the SelectionMode is set to SelectionMode.None. If using Multiple or Extended selection modes, returns the last item selected.

    Example
    For more information and examples on selecting data, refer to the Selecting Data topic.
    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