Selector.IsSelected Attached Property

Gets or sets a value that indicates whether an item is selected.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in PresentationFramework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

See Selector.GetIsSelected, Selector.SetIsSelected
See Selector.GetIsSelected, Selector.SetIsSelected
See Selector.GetIsSelected, Selector.SetIsSelected
<object Selector.IsSelected="bool" .../>

Property Value

true if the item is selected; otherwise, false.

Identifier Field

IsSelectedProperty, registered as Attached

Metadata Flags

None

Use this property to determine where there are any selected items in the Selector.

The following example shows how to create a ComboBox that has its first item selected when the control initializes.

<ComboBox IsEditable="true">
    <ComboBoxItem IsSelected="true">Item1</ComboBoxItem>
    <ComboBoxItem>Item2</ComboBoxItem>
    <ComboBoxItem>Item3</ComboBoxItem>
    <ComboBoxItem>Item4</ComboBoxItem>
    <ComboBoxItem>Item5</ComboBoxItem>
    <ComboBoxItem>Item6</ComboBoxItem>
    <ComboBoxItem>Item7</ComboBoxItem>
    <ComboBoxItem>Item8</ComboBoxItem>
    <ComboBoxItem>Item9</ComboBoxItem>
    <ComboBoxItem>Item10</ComboBoxItem>
    <ComboBoxItem>Item11</ComboBoxItem>
    <ComboBoxItem>Item12</ComboBoxItem>
    <ComboBoxItem>Item13</ComboBoxItem>
    <ComboBoxItem>Item14</ComboBoxItem>
    <ComboBoxItem>Item15</ComboBoxItem>
</ComboBox>

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.

Show: