Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ListBoxItem.IsSelected Property

 

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

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

[BindableAttribute(true)]
public bool IsSelected { get; set; }

Property Value

Type: System.Boolean

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

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

Identifier field

IsSelectedProperty

Metadata properties set to true

BindsTwoWayByDefault

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>

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft