Selector Selector Selector Selector Class
Definition
Represents a control that enables a user to select an item from a collection of items.
public : class Selector : ItemsControl, ISelectorpublic class Selector : ItemsControl, ISelectorPublic Class Selector Inherits ItemsControl Implements ISelector// This API is not available in Javascript.
- Inheritance
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited properties
Inherited events
Inherited methods
Remarks
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.
Properties
IsSynchronizedWithCurrentItem IsSynchronizedWithCurrentItem IsSynchronizedWithCurrentItem IsSynchronizedWithCurrentItem
Gets or sets a value that indicates whether a Selector should keep the SelectedItem synchronized with the current item in the Items property.
public : IReference<bool> IsSynchronizedWithCurrentItem { get; set; }public Nullable<bool> IsSynchronizedWithCurrentItem { get; set; }Public ReadWrite Property IsSynchronizedWithCurrentItem As Nullable<bool>// This API is not available in Javascript.
<selector IsSynchronizedWithCurrentItem="bool"/>
- or -
<selector IsSynchronizedWithCurrentItem="{x:Null}"/>
- Value
- IReference<PlatForm::Boolean> Nullable<bool> Nullable<bool> Nullable<bool>
true if the SelectedItem is always synchronized with the current item in the ItemCollection; false if the SelectedItem is never synchronized with the current item; null if the SelectedItem is synchronized with the current item only if the Selector uses an ICollectionView. The default value is null/indeterminate.
If you are programming using C#or Microsoft Visual Basic, the type of this property is projected as bool?(a nullable Boolean).
Remarks
The nullable value for IsSynchronizedWithCurrentItem enables the value to be indeterminate, neither true nor false. This is indicated by a value of null if accessed in code. To set the value to null in XAML, use the {x:Null} markup extension.
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.
- See Also
IsSynchronizedWithCurrentItemProperty IsSynchronizedWithCurrentItemProperty IsSynchronizedWithCurrentItemProperty IsSynchronizedWithCurrentItemProperty
Identifies the IsSynchronizedWithCurrentItem dependency property.
public : static DependencyProperty IsSynchronizedWithCurrentItemProperty { get; }public static DependencyProperty IsSynchronizedWithCurrentItemProperty { get; }Public Static ReadOnly Property IsSynchronizedWithCurrentItemProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the IsSynchronizedWithCurrentItem dependency property.
SelectedIndex SelectedIndex SelectedIndex SelectedIndex
Gets or sets the index of the selected item.
public : int SelectedIndex { get; set; }public int SelectedIndex { get; set; }Public ReadWrite Property SelectedIndex As int// This API is not available in Javascript.
<selector SelectedIndex="int" .../>
- Value
- int int int int
The index of the selected item. The default is -1.
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.
SelectedIndexProperty SelectedIndexProperty SelectedIndexProperty SelectedIndexProperty
Identifies the SelectedIndex dependency property.
public : static DependencyProperty SelectedIndexProperty { get; }public static DependencyProperty SelectedIndexProperty { get; }Public Static ReadOnly Property SelectedIndexProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the SelectedIndex dependency property.
SelectedItem SelectedItem SelectedItem SelectedItem
Gets or sets the selected item.
public : PlatForm::Object SelectedItem { get; set; }public object SelectedItem { get; set; }Public ReadWrite Property SelectedItem As object// This API is not available in Javascript.
<selector SelectedItem="bindingReference" .../>
- Value
- PlatForm::Object object object object
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.
SelectedItemProperty SelectedItemProperty SelectedItemProperty SelectedItemProperty
Identifies the SelectedItem dependency property.
public : static DependencyProperty SelectedItemProperty { get; }public static DependencyProperty SelectedItemProperty { get; }Public Static ReadOnly Property SelectedItemProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the SelectedItem dependency property.
SelectedValue SelectedValue SelectedValue SelectedValue
Gets or sets the value of the selected item, obtained by using the SelectedValuePath.
public : PlatForm::Object SelectedValue { get; set; }public object SelectedValue { get; set; }Public ReadWrite Property SelectedValue As object// This API is not available in Javascript.
<selector SelectedValue="valueAsString"/>
- Value
- PlatForm::Object object object object
The value of the selected item, obtained by using the SelectedValuePath, or null if no item is selected. The default value is null.
SelectedValuePath SelectedValuePath SelectedValuePath SelectedValuePath
Gets or sets the property path that is used to get the SelectedValue property of the SelectedItem property.
public : PlatForm::String SelectedValuePath { get; set; }public string SelectedValuePath { get; set; }Public ReadWrite Property SelectedValuePath As string// This API is not available in Javascript.
<selector SelectedValuePath="propertyPath"/>
- Value
- PlatForm::String string string string
The property path that is used to get the SelectedValue property of the SelectedItem property. The default is String.Empty.
SelectedValuePathProperty SelectedValuePathProperty SelectedValuePathProperty SelectedValuePathProperty
Gets the identifier for the SelectedValuePath dependency property.
public : static DependencyProperty SelectedValuePathProperty { get; }public static DependencyProperty SelectedValuePathProperty { get; }Public Static ReadOnly Property SelectedValuePathProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the SelectedValuePath dependency property.
SelectedValueProperty SelectedValueProperty SelectedValueProperty SelectedValueProperty
Gets the identifier for the SelectedValue dependency property.
public : static DependencyProperty SelectedValueProperty { get; }public static DependencyProperty SelectedValueProperty { get; }Public Static ReadOnly Property SelectedValueProperty As DependencyProperty// This API is not available in Javascript.
The identifier for the SelectedValue dependency property.
Methods
GetIsSelectionActive(DependencyObject) GetIsSelectionActive(DependencyObject) GetIsSelectionActive(DependencyObject) GetIsSelectionActive(DependencyObject)
Gets a value that indicates whether the specified Selector has the focus.
public : static PlatForm::Boolean GetIsSelectionActive(DependencyObject element)public static bool GetIsSelectionActive(DependencyObject element)Public Static Function GetIsSelectionActive(element As DependencyObject) As bool// This API is not available in Javascript.
The Selector to evaluate.
true to indicate that the Selector has the focus; otherwise, false.
Events
SelectionChanged SelectionChanged SelectionChanged SelectionChanged
Occurs when the currently selected item changes.
public : event SelectionChangedEventHandler SelectionChangedpublic event SelectionChangedEventHandler SelectionChangedPublic Event SelectionChanged// This API is not available in Javascript.
<selector SelectionChanged="eventhandler"/>
Remarks
Note
For ListView and GridView: If the ItemsSource implements IItemsRangeInfo, and selection is modified using SelectRange or DeselectRange, the AddedItems and RemovedItems properties are not set in the SelectionChangedEventArgs. Setting these properties requires devirtualizing the item object. Use the SelectedRanges property to get the items instead.