Gets or sets the selected item.
Syntax
<selector SelectedItem="bindingReference" .../>
XAML Values
- bindingReference
-
A data binding reference to a specific item from the data collection that populates the selector control. Usually the list as a whole is bound to a data context, and the binding for the selected item adds a path or qualifier to return just one item.
Property value
Type: System.Object [.NET] | Platform::Object [C++]
The selected item. The default is null.
Remarks
Some controls that are derived from Selector, like ListBox, ListView, and GridView, also support multi-selection. When multi-selection is enabled in those controls, use their SelectedItems property to get the selected item collection.
Selection behavior and CollectionViewSource
The default selection behavior in list controls that derive from the Selector class depends on what the items source is (the type that's used for ItemsSource). If the items source is an instance of the CollectionViewSource class, the selection in the selection control defaults to the current item. When the list is first displayed, the selection defaults to the first item as the current item. If you don't want the first item to be selected in this case, set IsSynchronizedWithCurrentItem to false in the GridView, ListView, or other Selector-based control that is showing the selection.
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Namespace |
|
|
Metadata |
|
See also
- Selector
- ListBox.SelectionMode
- ListBox.SelectedItems
- ListViewBase.SelectionMode
- ListViewBase.SelectedItems
Build date: 3/12/2013