DomainSpinner
A custom control to support spinning up/down across a set of objects.
public class DomainSpinner : Control
Inherits from / implements: Control
Remarks
How this control works. The template supplies a text box and two repeat buttons; the control keeps an index into Items and the item at that index as Value. The two always agree: setting SelectedIndex sets the value, and setting Value finds its index (an item matches by equality or by its text), or -1 when the value is not one of the items. The text box shows the value's text, or an edit in progress. Changing the items keeps the value when it can. A new list that holds the current value keeps it at its new index; otherwise the first item is selected, and an empty or missing list clears the value. Typing completes. Each keystroke, or a paste, selects the first item whose text begins with what has been typed (ignoring case), shows it whole and selects the part not typed, so the next keystroke carries on the match; text that begins no item is refused. Enter or leaving the box takes an exact match, ignoring case, and otherwise puts the text back to the value; Escape puts it back too. Stepping. The increase button, Up and Page Up move to the next item; the decrease button, Down and Page Down to the previous one; Ctrl+Home and Ctrl+End to the first and last. Wrap carries a step past either end round to the other. With no selection, a step selects the first item. The mouse wheel steps only while the text box has keyboard focus. IsReadOnly stops all of these, and the buttons.
Members at a glance
DomainSpinner | Initializes a new instance of the DomainSpinner class. |
ContentHostControlStyle | Gets or sets the content host control style. |
IsReadOnly | Gets or sets a value indicating whether this instance is read only. |
Items | Gets or sets the items. |
NavigationControlStyle | Gets or sets the navigation control style. |
NavigationVisualFillBrush | Gets or sets the navigation visual fill brush. |
NavigationVisualOnMouseOverBorderBrush | Gets or sets the navigation visual on mouse-over border brush. |
NavigationVisualOnMouseOverBrush | Gets or sets the navigation visual on mouse-over brush. |
NavigationVisualStroke | Gets or sets the navigation visual stroke. |
SelectedIndex | Gets or sets the index of the selected item in Items, or -1 for none. |
Value | Gets or sets the value: the selected item, or null for none. |
Wrap | Gets or sets a value indicating whether stepping past the last item goes to the first, and stepping back past the first goes to the last. |
OnApplyTemplate | When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate. |
ValueChanged | Occurs when the value changes |
ContentHostControlStyleProperty | The content host control style property |
IsReadOnlyProperty | The instance is read-only. |
ItemsProperty | The items property |
NavigationControlStyleProperty | The navigation control style property |
NavigationVisualFillBrushProperty | The navigation visual fill brush property |
NavigationVisualOnMouseOverBorderBrushProperty | The navigation visual on mouse-over border brush property |
NavigationVisualOnMouseOverBrushProperty | The navigation visual on mouse-over brush property |
NavigationVisualStrokeProperty | The navigation visual stroke property |
ValueChangedEvent | The value changed event |
ValueProperty | The value property |
WrapProperty | Identifies the Wrap dependency property. |
Constructors
DomainSpinner
Initializes a new instance of the DomainSpinner class.
Properties
ContentHostControlStyle
Gets or sets the content host control style.
Value. The content host control style.
IsReadOnly
Gets or sets a value indicating whether this instance is read only.
Value. true if this instance is read only; otherwise, false .
Items
Gets or sets the items.
Value. The items.
SelectedIndex
Gets or sets the index of the selected item in Items, or -1 for none.
Value. The index of the selected item. An index outside the items is ignored, and so is any index while Items is not set.
Value
Gets or sets the value: the selected item, or null for none.
Value. The value.
Wrap
Gets or sets a value indicating whether stepping past the last item goes to the first, and stepping back past the first goes to the last.
Value. true to wrap; false (the default) to stop at either end.
Methods
OnApplyTemplate
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate.
Events
ValueChanged
Occurs when the value changes
Fields
ContentHostControlStyleProperty
The content host control style property
IsReadOnlyProperty
The instance is read-only.
ItemsProperty
The items property
ValueChangedEvent
The value changed event
ValueProperty
The value property
WrapProperty
Identifies the Wrap dependency property.