Selector Selector Selector Class

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

Syntax

Declaration

public class Selectorpublic class SelectorPublic Class Selector

Inheritance Hierarchy

Inherited Members

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Tag
Tag
Tag
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

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 summary

Gets or sets a value that indicates whether a Selector should keep the SelectedItem synchronized with the current item in the Items property.

Identifies the IsSynchronizedWithCurrentItem dependency property.

Gets or sets the index of the selected item.

Identifies the SelectedIndex dependency property.

Gets or sets the selected item.

Identifies the SelectedItem dependency property.

Gets or sets the value of the selected item, obtained by using the SelectedValuePath.

Gets or sets the property path that is used to get the SelectedValue property of the SelectedItem property.

Gets the identifier for the SelectedValuePath dependency property.

Gets the identifier for the SelectedValue dependency property.

Methods summary

Gets a value that indicates whether the specified Selector has the focus.

Events summary

Occurs when the currently selected item changes.

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 IReference<bool> IsSynchronizedWithCurrentItem { get; set; }Public ReadWrite Property IsSynchronizedWithCurrentItem As IReference<bool>
    <selector IsSynchronizedWithCurrentItem="bool"/>
    - or -
    <selector IsSynchronizedWithCurrentItem="{x:Null}"/>
    

    Property Value

    • 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.

  • 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

    Property Value

  • 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
    <selector SelectedIndex="int" .../>
    

    Property Value

    • 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

    Property Value

  • SelectedItem
    SelectedItem
    SelectedItem
    SelectedItem

    Gets or sets the selected item.

    public object SelectedItem { get; set; }public object SelectedItem { get; set; }Public ReadWrite Property SelectedItem As object
    <selector SelectedItem="bindingReference" .../>
    

    Property Value

    • 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

    Property Value

  • SelectedValue
    SelectedValue
    SelectedValue
    SelectedValue

    Gets or sets the value of the selected item, obtained by using the SelectedValuePath.

    public object SelectedValue { get; set; }public object SelectedValue { get; set; }Public ReadWrite Property SelectedValue As object
    <selector SelectedValue="valueAsString"/>
    

    Property Value

    • 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 string SelectedValuePath { get; set; }public string SelectedValuePath { get; set; }Public ReadWrite Property SelectedValuePath As string
    <selector SelectedValuePath="propertyPath"/>
    

    Property Value

  • 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

    Property Value

  • 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

    Property Value

Methods

  • GetIsSelectionActive(Windows.UI.Xaml.DependencyObject)
    GetIsSelectionActive(Windows.UI.Xaml.DependencyObject)
    GetIsSelectionActive(Windows.UI.Xaml.DependencyObject)
    GetIsSelectionActive(Windows.UI.Xaml.DependencyObject)

    Gets a value that indicates whether the specified Selector has the focus.

    public static bool GetIsSelectionActive(Windows.UI.Xaml.DependencyObject)public static bool GetIsSelectionActive(Windows.UI.Xaml.DependencyObject)Public Static Function GetIsSelectionActive(Windows.UI.Xaml.DependencyObject) As bool

    Parameters

    Returns

    • bool
      bool
      bool

      true to indicate that the Selector has the focus; otherwise, false.

Events

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.ComposableAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.UI.Xaml.Controls.Primitives.dll