Skip to content

IntegerSpinner

JaykeBird edited this page Feb 21, 2023 · 10 revisions

Back to home | Back to Reference | View raw text

IntegerSpinner class

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph SolidShineUi
  SolidShineUi.IntegerSpinner[[IntegerSpinner]]
  end
  subgraph System.Windows.Markup
System.Windows.Markup.IComponentConnector[[IComponentConnector]]
  end
  subgraph System.Windows.Controls
System.Windows.Controls.UserControl[[UserControl]]
  end
System.Windows.Markup.IComponentConnector --> SolidShineUi.IntegerSpinner
System.Windows.Controls.UserControl --> SolidShineUi.IntegerSpinner
Loading

Members

Properties

Public properties

Type Name Methods
bool AcceptExpressions
Get or set if the spinner should evaluate arithmetic expressions (such as "2+5") to accept as a value.
get, set
Brush BorderBrush
Get or set the brush of the border around the control.
get, set
Brush BorderDisabledBrush
Get or set the brush used for the border around the control, while the control is disabled.
get, set
Brush ButtonBackground
Get or set the brush used for the background of the buttons of the spinner.
get, set
Brush ClickBrush
Get or set the brush used when a button is being clicked.
get, set
ColorScheme ColorScheme
Get or set the color scheme used for this spinner. For easier color scheme management, bind this to the window or larger control you're using.
get, set
CornerRadius CornerRadius
Get or set the corner radius to use around the corners of this control. Setting the corner radius to a value other than 0 displays rounded corners.
get, set
Brush DisabledBrush
Get or set the brush used for the background of the buttons when the control is disabled.
get, set
bool DisplayAsHex
Get or set whether to show the value as a hexadecimal or decimal value. Note that while DisplayAsHex is set to true, IntegerSpinner.AcceptExpressions is ignored.
get, set
Brush HighlightBrush
Get or set the brush used when a button is highlighted (i.e. has a mouse over it or keyboard focus).
get, set
int MaxValue
Get or set the maximum value allowed for this spinner (inclusive).
get, set
int MinValue
Get or set the minimum value allowed for this spinner (inclusive).
get, set
int MinimumDigitCount
Get or set the minimum number of digits to display in the spinner. A value of 0 or lower will display only the minimum needed for the number being displayed.
get, set
double RepeatDelay
Get or set the delay period before starting the repeatedly stepping up or down while the button is held, in milliseconds. Default is 300 milliseconds.
get, set
bool ShowArrows
Get or set whether the up and down arrow buttons are shown.
get, set
int Step
Get or set how much to change the value by when you press the up or down button.
get, set
int Value
Get or set the value of the spinner.
get, set

Methods

Public Static methods

Returns Name
void OnColorSchemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Perform an action when the ColorScheme property has changed. Primarily used internally.

Public methods

Returns Name
void ApplyColorScheme(ColorScheme cs)
Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.
void InitializeComponent()
InitializeComponent

Details

Inheritance

  • IComponentConnector
  • UserControl

Constructors

IntegerSpinner

public IntegerSpinner()
Summary

Create an IntegerSpinner.

Methods

OnColorSchemeChanged

public static void OnColorSchemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
Arguments
Type Name Description
DependencyObject d The object containing the property that changed.
DependencyPropertyChangedEventArgs e Event arguments about the property change.
Summary

Perform an action when the ColorScheme property has changed. Primarily used internally.

ApplyColorScheme

public void ApplyColorScheme(ColorScheme cs)
Arguments
Type Name Description
ColorScheme cs The color scheme to apply.
Summary

Apply a color scheme to this control. The color scheme can quickly apply a whole visual style to the control.

InitializeComponent

public virtual void InitializeComponent()
Summary

InitializeComponent

Properties

ColorScheme

public ColorScheme ColorScheme { get; set; }
Summary

Get or set the color scheme used for this spinner. For easier color scheme management, bind this to the window or larger control you're using.

ButtonBackground

public Brush ButtonBackground { get; set; }
Summary

Get or set the brush used for the background of the buttons of the spinner.

DisabledBrush

public Brush DisabledBrush { get; set; }
Summary

Get or set the brush used for the background of the buttons when the control is disabled.

BorderBrush

public Brush BorderBrush { get; set; }
Summary

Get or set the brush of the border around the control.

HighlightBrush

public Brush HighlightBrush { get; set; }
Summary

Get or set the brush used when a button is highlighted (i.e. has a mouse over it or keyboard focus).

ClickBrush

public Brush ClickBrush { get; set; }
Summary

Get or set the brush used when a button is being clicked.

BorderDisabledBrush

public Brush BorderDisabledBrush { get; set; }
Summary

Get or set the brush used for the border around the control, while the control is disabled.

Value

public int Value { get; set; }
Summary

Get or set the value of the spinner.

Step

public int Step { get; set; }
Summary

Get or set how much to change the value by when you press the up or down button.

MinValue

public int MinValue { get; set; }
Summary

Get or set the minimum value allowed for this spinner (inclusive).

MaxValue

public int MaxValue { get; set; }
Summary

Get or set the maximum value allowed for this spinner (inclusive).

RepeatDelay

public double RepeatDelay { get; set; }
Summary

Get or set the delay period before starting the repeatedly stepping up or down while the button is held, in milliseconds. Default is 300 milliseconds.

CornerRadius

public CornerRadius CornerRadius { get; set; }
Summary

Get or set the corner radius to use around the corners of this control. Setting the corner radius to a value other than 0 displays rounded corners.

AcceptExpressions

public bool AcceptExpressions { get; set; }
Summary

Get or set if the spinner should evaluate arithmetic expressions (such as "2+5") to accept as a value.

Remarks

See the ArithmeticParser class for more info about how expressions are parsed. Note that AcceptExpressions is ignored (and expressions not accepted) while IntegerSpinner.DisplayAsHex is set to true.

ShowArrows

public bool ShowArrows { get; set; }
Summary

Get or set whether the up and down arrow buttons are shown.

DisplayAsHex

public bool DisplayAsHex { get; set; }
Summary

Get or set whether to show the value as a hexadecimal or decimal value. Note that while DisplayAsHex is set to true, IntegerSpinner.AcceptExpressions is ignored.

Remarks

Certain situations, particularly involving computer representations of data or memory, may benefit more with displaying numbers as hexadecimals rather than decimals. With hexadecimals, the letters A-F are allowed along with 0-9, and the number "15" in decimal turns into "F" in hexadecimal. Please view online resources like Wikipedia for more details.

MinimumDigitCount

public int MinimumDigitCount { get; set; }
Summary

Get or set the minimum number of digits to display in the spinner. A value of 0 or lower will display only the minimum needed for the number being displayed.

Remarks

This modifies the number of digits being rendered via Int32.ToString(System.String) . Setting this to 4 and then setting the Value to 16 will render the text 0016 in the display. The stored value isn't affected. You should generally avoid setting this to numbers larger than 99, as larger numbers are only supported in newer versions of .NET.

Events

PropertyChanged

public event EventHandler PropertyChanged
Summary

Raised when the Value, MinValue, or MaxValue properties are changed. Used internally to trigger revalidating the value.

ValueChanged

public event DependencyPropertyChangedEventHandler ValueChanged
Summary

Raised when the Value property is changed.

ValueValidated

public event EventHandler ValueValidated
Summary

Raised when the Value property is validated, and changed to a valid value if needed.

ColorSchemeChanged

public event DependencyPropertyChangedEventHandler ColorSchemeChanged
Summary

Raised when the ColorScheme property is changed.

InternalValueChanged

protected event DependencyPropertyChangedEventHandler InternalValueChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

InternalRepeatDelayChanged

protected event DependencyPropertyChangedEventHandler InternalRepeatDelayChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

RepeatDelayChanged

public event RoutedEventHandler RepeatDelayChanged
Summary

Raised when the RepeatDelay property is changed.

InternalCornerRadiusChanged

protected event DependencyPropertyChangedEventHandler InternalCornerRadiusChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

CornerRadiusChanged

public event RoutedEventHandler CornerRadiusChanged
Summary

Raised when the CornerRadius property is changed.

InternalShowArrowsChanged

protected event DependencyPropertyChangedEventHandler InternalShowArrowsChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

ShowArrowsChanged

public event RoutedEventHandler ShowArrowsChanged
Summary

Raised when the ShowArrows property is changed.

InternalDisplayAsHexChanged

protected event DependencyPropertyChangedEventHandler InternalDisplayAsHexChanged
Summary

Internal event for handling a property changed. Please view the event that is not prefixed as "Internal".

DisplayAsHexChanged

public event RoutedEventHandler DisplayAsHexChanged
Summary

Raised when the DisplayAsHex property is changed.

Generated with ModularDoc

Clone this wiki locally