Udostępnij za pośrednictwem


Selector.SelectedItem Property

Definition

Gets or sets the selected item.

public:
 property Platform::Object ^ SelectedItem { Platform::Object ^ get(); void set(Platform::Object ^ value); };
IInspectable SelectedItem();

void SelectedItem(IInspectable value);
public object SelectedItem { get; set; }
var object = selector.selectedItem;
selector.selectedItem = object;
Public Property SelectedItem As Object
<selector SelectedItem="bindingReference" .../>

Property Value

Object

Platform::Object

IInspectable

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

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.

Applies to

See also