Class Selector
Represents a control that allows a user to select an item from a collection of items.
Inheritance
Inherited Members
Namespace: System.Windows.Controls.Primitives
Assembly: OpenSilver.dll
Syntax
public class Selector : ItemsControl, IControl, IFrameworkElement, IUIElement, IDependencyObject
Constructors
| Improve this Doc View SourceSelector()
Initializes a new instance of the Selector class.
Declaration
public Selector()
Fields
| Improve this Doc View SourceIsSynchronizedWithCurrentItemProperty
Identifies the IsSynchronizedWithCurrentItem dependency property.
Declaration
public static readonly DependencyProperty IsSynchronizedWithCurrentItemProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedIndexProperty
Identifies the SelectedIndex dependency property.
Declaration
public static readonly DependencyProperty SelectedIndexProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedItemProperty
Identifies the SelectedItem dependency property.
Declaration
public static readonly DependencyProperty SelectedItemProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedValuePathProperty
Identifies the SelectedValuePath dependency property.
Declaration
public static readonly DependencyProperty SelectedValuePathProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedValueProperty
Identifies the SelectedValue dependency property.
Declaration
public static readonly DependencyProperty SelectedValueProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceHasItems
Gets whether the Selector contains items.
Declaration
protected bool HasItems { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSynchronizedWithCurrentItem
Gets or sets a value that indicates whether the Selector should keep the SelectedItem synchronized with the current item in the Items property.
Declaration
public bool? IsSynchronizedWithCurrentItem { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> | true if the SelectedItem is always synchronized with the current item; 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 a ICollectionView. The default is null. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | IsSynchronizedWithCurrentItem is set to true. |
SelectedIndex
Gets or sets the index of the selected item.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SelectedItem
Gets or sets the selected item.
Declaration
public object SelectedItem { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
SelectedValue
Gets or sets the value of the selected item, obtained by using the SelectedValuePath.
Declaration
public object SelectedValue { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
SelectedValuePath
Gets or sets the property path that is used to get the SelectedValue property of the SelectedItem property.
Declaration
public string SelectedValuePath { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceClearContainerForItemOverride(DependencyObject, Object)
Removes any bindings and templates applied to the item container for the specified content.
Declaration
protected override void ClearContainerForItemOverride(DependencyObject element, object item)
Parameters
Type | Name | Description |
---|---|---|
DependencyObject | element | The combo box item used to display the specified content. |
System.Object | item | The item content. |
Overrides
| Improve this Doc View SourceGetIsSelectionActive(DependencyObject)
Gets a value that indicates whether the specified Selector has the focus.
Declaration
public static bool GetIsSelectionActive(DependencyObject element)
Parameters
Type | Name | Description |
---|---|---|
DependencyObject | element | The Selector to evaluate. |
Returns
Type | Description |
---|---|
System.Boolean | true to indicate that the Selector has the focus; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | element is null. |
OnApplyTemplate()
Builds the visual tree for the Selector control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnItemsChanged(NotifyCollectionChangedEventArgs)
Declaration
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.NotifyCollectionChangedEventArgs | e |
Overrides
| Improve this Doc View SourceOnItemsSourceChanged(IEnumerable, IEnumerable)
Declaration
protected override void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | oldValue | |
System.Collections.IEnumerable | newValue |
Overrides
| Improve this Doc View SourceOnSelectionChanged(SelectionChangedEventArgs)
Raises the SelectionChanged event
Declaration
protected virtual void OnSelectionChanged(SelectionChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
SelectionChangedEventArgs | e | The arguments for the event. |
PrepareContainerForItemOverride(DependencyObject, Object)
Prepares the specified element to display the specified item.
Declaration
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameters
Type | Name | Description |
---|---|---|
DependencyObject | element | The element used to display the specified item. |
System.Object | item | The item to display |
Overrides
Events
| Improve this Doc View SourceSelectionChanged
Occurs when the selection is changed.
Declaration
public event SelectionChangedEventHandler SelectionChanged
Event Type
Type | Description |
---|---|
SelectionChangedEventHandler |