Table of Contents

Class Slider

Namespace
Myra.Graphics2D.UI
Assembly
Myra.dll

An abstract base class for slider widgets that allow users to select a value within a range.

public abstract class Slider : Widget, IItemWithId, INotifyAttachedPropertyChanged
Inheritance
Slider
Implements
Derived
Inherited Members

Constructors

Slider(Stylesheet, string)

Initializes a new instance of the Slider class with the specified stylesheet and style.

protected Slider(Stylesheet stylesheet, string styleName)

Parameters

stylesheet Stylesheet

The stylesheet to use for applying the style.

styleName string

The name of the style to apply.

Slider(string)

Initializes a new instance of the Slider class with the specified style.

protected Slider(string styleName)

Parameters

styleName string

The name of the style to apply.

Properties

AcceptsMouseWheel

Gets a value indicating whether the slider accepts mouse wheel input.

protected override bool AcceptsMouseWheel { get; }

Property Value

bool

Desktop

Gets or sets the desktop this slider is part of, managing touch event subscriptions.

public override Desktop Desktop { get; }

Property Value

Desktop

ImageButton

Gets the button widget that acts as the slider's draggable knob.

[Browsable(false)]
public Button ImageButton { get; }

Property Value

Button

Maximum

Gets or sets the maximum value of the slider. Default is 100.0.

public float Maximum { get; set; }

Property Value

float

Minimum

Gets or sets the minimum value of the slider. Default is 0.0.

public float Minimum { get; set; }

Property Value

float

Orientation

Gets the orientation of the slider (horizontal or vertical).

[Browsable(false)]
public abstract Orientation Orientation { get; }

Property Value

Orientation

Value

Gets or sets the current value of the slider between Minimum and Maximum. Default is 0.0.

public float Value { get; set; }

Property Value

float

WheelAdjustment

Gets or sets a value indicating whether the slider can be adjusted with the mouse wheel. Default is false.

public bool WheelAdjustment { get; set; }

Property Value

bool

WheelStep

Gets or sets the amount to adjust the value when using the mouse wheel. Default is 1.0.

public float WheelStep { get; set; }

Property Value

float

Methods

ApplyStyle(WidgetStyle)

Applies the specified widget style to this slider.

protected override void ApplyStyle(WidgetStyle style)

Parameters

style WidgetStyle

The widget style to apply.

CopyFrom(Widget)

Copies the properties from another slider widget.

protected override void CopyFrom(Widget w)

Parameters

w Widget

The source slider widget to copy from.

InternalArrange()

Arranges the slider and synchronizes the hint (knob position) with the current value.

protected override void InternalArrange()

OnMouseWheel(float)

Handles mouse wheel input to adjust the slider value if wheel adjustment is enabled.

public override void OnMouseWheel(float delta)

Parameters

delta float

The mouse wheel delta value (positive for up/forward, negative for down/back).

OnTouchDown()

Handles touch down events and activates the slider for dragging.

public override void OnTouchDown()

Events

ValueChanged

Occurs when the value of the slider changes, regardless of whether it was changed by user input or programmatically.

public event MyraEventHandler<ValueChangedEventArgs<float>> ValueChanged

Event Type

MyraEventHandler<ValueChangedEventArgs<float>>

ValueChangedByUser

Occurs when the value of the slider changes due to user interaction (dragging or mouse wheel). Does not fire for programmatic value changes.

public event MyraEventHandler<ValueChangedEventArgs<float>> ValueChangedByUser

Event Type

MyraEventHandler<ValueChangedEventArgs<float>>