ListBoxItem.IsSelected Property

Gets or sets a value that indicates whether a ListBoxItem is selected. This is a dependency property.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public bool IsSelected { get; set; }
/** @property */
public boolean get_IsSelected ()

/** @property */
public void set_IsSelected (boolean value)

public function get IsSelected () : boolean

public function set IsSelected (value : boolean)

<object IsSelected="bool" .../>

Property Value

true if the item is selected; otherwise, false. The default is false.

Identifier field


Metadata properties set to true


To select a ListBoxItem in a ListBox, set this property to true.

The following example shows how to set a list box item to be selected when the list box is created.

<ListBoxItem Name="item0" IsSelected="true">Item 0</ListBoxItem>

The following example shows how to test whether a list box item is selected.

private void SelectedItem(object sender, RoutedEventArgs e)
    if (item1.IsSelected == true)
        label2.Content = "IsSelected.";

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions