HypernovaDesktop Components · docs
Binarymission
WPF › Spinner › DomainSpinner

DomainSpinner

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.InputControls

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

DomainSpinnerInitializes a new instance of the DomainSpinner class.
ContentHostControlStyleGets or sets the content host control style.
IsReadOnlyGets or sets a value indicating whether this instance is read only.
ItemsGets or sets the items.
NavigationControlStyleGets or sets the navigation control style.
NavigationVisualFillBrushGets or sets the navigation visual fill brush.
NavigationVisualOnMouseOverBorderBrushGets or sets the navigation visual on mouse-over border brush.
NavigationVisualOnMouseOverBrushGets or sets the navigation visual on mouse-over brush.
NavigationVisualStrokeGets or sets the navigation visual stroke.
SelectedIndexGets or sets the index of the selected item in Items, or -1 for none.
ValueGets or sets the value: the selected item, or null for none.
WrapGets 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.
OnApplyTemplateWhen overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate.
ValueChangedOccurs when the value changes
ContentHostControlStylePropertyThe content host control style property
IsReadOnlyPropertyThe instance is read-only.
ItemsPropertyThe items property
NavigationControlStylePropertyThe navigation control style property
NavigationVisualFillBrushPropertyThe navigation visual fill brush property
NavigationVisualOnMouseOverBorderBrushPropertyThe navigation visual on mouse-over border brush property
NavigationVisualOnMouseOverBrushPropertyThe navigation visual on mouse-over brush property
NavigationVisualStrokePropertyThe navigation visual stroke property
ValueChangedEventThe value changed event
ValuePropertyThe value property
WrapPropertyIdentifies the Wrap dependency property.

Constructors

DomainSpinner

public DomainSpinner()

Initializes a new instance of the DomainSpinner class.

Properties

ContentHostControlStyle

public Style ContentHostControlStyle

Gets or sets the content host control style.

Value. The content host control style.

IsReadOnly

public bool IsReadOnly

Gets or sets a value indicating whether this instance is read only.

Value. true if this instance is read only; otherwise, false .

Items

public IEnumerable<object> Items

Gets or sets the items.

Value. The items.

NavigationControlStyle

public Style NavigationControlStyle

Gets or sets the navigation control style.

Value. The navigation control style.

NavigationVisualFillBrush

public Brush NavigationVisualFillBrush

Gets or sets the navigation visual fill brush.

Value. The navigation visual fill brush.

NavigationVisualOnMouseOverBorderBrush

public Brush NavigationVisualOnMouseOverBorderBrush

Gets or sets the navigation visual on mouse-over border brush.

Value. The navigation visual on mouse over border brush.

NavigationVisualOnMouseOverBrush

public Brush NavigationVisualOnMouseOverBrush

Gets or sets the navigation visual on mouse-over brush.

Value. The navigation visual on mouse-over brush.

NavigationVisualStroke

public Brush NavigationVisualStroke

Gets or sets the navigation visual stroke.

Value. The navigation visual stroke.

SelectedIndex

public int 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

public object Value

Gets or sets the value: the selected item, or null for none.

Value. The value.

Wrap

public bool 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

public override void OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate.

Events

ValueChanged

public event RoutedEventHandler ValueChanged

Occurs when the value changes

Fields

ContentHostControlStyleProperty

public static readonly DependencyProperty ContentHostControlStyleProperty

The content host control style property

IsReadOnlyProperty

public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register( "IsReadOnly", typeof(bool), typeof(DomainSpinner), new PropertyMetadata(default(bool), (o, args)

The instance is read-only.

ItemsProperty

public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register("Items", typeof(IEnumerable<object>), typeof(DomainSpinner), new UIPropertyMetadata(null, (o, e)

The items property

NavigationControlStyleProperty

public static readonly DependencyProperty NavigationControlStyleProperty

The navigation control style property

NavigationVisualFillBrushProperty

public static readonly DependencyProperty NavigationVisualFillBrushProperty

The navigation visual fill brush property

NavigationVisualOnMouseOverBorderBrushProperty

public static readonly DependencyProperty NavigationVisualOnMouseOverBorderBrushProperty

The navigation visual on mouse-over border brush property

NavigationVisualOnMouseOverBrushProperty

public static readonly DependencyProperty NavigationVisualOnMouseOverBrushProperty

The navigation visual on mouse-over brush property

NavigationVisualStrokeProperty

public static readonly DependencyProperty NavigationVisualStrokeProperty

The navigation visual stroke property

ValueChangedEvent

public static readonly RoutedEvent ValueChangedEvent

The value changed event

ValueProperty

public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(DomainSpinner), new UIPropertyMetadata(null, (o, e)

The value property

WrapProperty

public static readonly DependencyProperty WrapProperty

Identifies the Wrap dependency property.