Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 3.38 KB

File metadata and controls

44 lines (29 loc) · 3.38 KB
-api-id -api-type
T:Microsoft.UI.Xaml.Controls.Primitives.Selector
winrt class

Microsoft.UI.Xaml.Controls.Primitives.Selector

-description

Represents a control that enables a user to select an item from a collection of items.

-remarks

Selector has properties that enable selection of a single item in a collection.

  • SelectedIndex: The 0-based index of the selected item. The default is -1, which indicates no item is selected.
  • SelectedItem: The selected data item. The default is null, which indicates no item is selected.
  • SelectedValue: The value of the selected data item, obtained by using the SelectedValuePath.

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

List controls that derive from Selector have a default selection behavior that depends on what the items source is (the type that's used for ItemsSource). If the items source is a CollectionViewSource instance, then the behavior in the selection control is that the selection will default to the current item. When the list is first displayed, the selection defaults to the first item as current item. If you don't want the first item to be selected in this case, set IsSynchronizedWithCurrentItem to false in the GridView, the ListView, or other Selector-based control that is showing the selection.

Selector derived classes

Selector is the parent class for these controls:

Note

SemanticZoom is a similar control but it doesn't enable selection itself. SemanticZoom inherits directly from Control . A SemanticZoom typically displays one of the Selector derived controls in each of its views.

-examples

-see-also

ItemsControl, Adding ListView and GridView controls, Adding ListView, SemanticZoom, and other data controls, How to add a list box