SelectedItem Property

Selector.SelectedItem Property


Gets or sets the first item in the current selection or returns null if the selection is empty

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

member SelectedItem : Object with get, set

Property Value

Type: System.Object

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

If a Selector supports selecting a single item, the SelectedItem property returns the selected item. If a Selector supports multiple selections, SelectedItem returns the item that the user selected first.

Setting SelectedItem in a Selector that supports multiple selections clears existing selected items and sets the selection to the item specified.

The following example gets the SelectedItem from a ListBox.

No code example is currently available or this language may not be supported.

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