Table of Contents

Class Slider

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

A control that lets the user select from a range of values by moving a Thumb control along a Track.

[TemplatePart("PART_DecreaseButton", typeof(Button))]
[TemplatePart("PART_IncreaseButton", typeof(Button))]
[TemplatePart("PART_Track", typeof(Track))]
[PseudoClasses(new string[] { ":vertical", ":horizontal", ":pressed" })]
public class Slider : RangeBase, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
Inheritance
Slider
Implements
Inherited Members
Extension Methods

Constructors

Slider()

Instantiates a new instance of the Slider class.

public Slider()

Fields

IsDirectionReversedProperty

Defines the IsDirectionReversed property.

public static readonly StyledProperty<bool> IsDirectionReversedProperty

Field Value

StyledProperty<bool>

IsSnapToTickEnabledProperty

Defines the IsSnapToTickEnabled property.

public static readonly StyledProperty<bool> IsSnapToTickEnabledProperty

Field Value

StyledProperty<bool>

OrientationProperty

Defines the Orientation property.

public static readonly StyledProperty<Orientation> OrientationProperty

Field Value

StyledProperty<Orientation>

TickFrequencyProperty

Defines the TickFrequency property.

public static readonly StyledProperty<double> TickFrequencyProperty

Field Value

StyledProperty<double>

TickPlacementProperty

Defines the TickPlacement property.

public static readonly StyledProperty<TickPlacement> TickPlacementProperty

Field Value

StyledProperty<TickPlacement>

TicksProperty

Defines the Ticks property.

public static readonly StyledProperty<AvaloniaList<double>?> TicksProperty

Field Value

StyledProperty<AvaloniaList<double>>

Properties

IsDirectionReversed

Gets or sets the direction of increasing value.

public bool IsDirectionReversed { get; set; }

Property Value

bool

true if the direction of increasing value is to the left for a horizontal slider or down for a vertical slider; otherwise, false. The default is false.

IsDragging

Gets a value indicating whether the Slider is currently being dragged.

protected bool IsDragging { get; }

Property Value

bool

IsSnapToTickEnabled

Gets or sets a value that indicates whether the Slider automatically moves the Thumb to the closest tick mark.

public bool IsSnapToTickEnabled { get; set; }

Property Value

bool

Orientation

Gets or sets the orientation of a Slider.

public Orientation Orientation { get; set; }

Property Value

Orientation

TickFrequency

Gets or sets the interval between tick marks.

public double TickFrequency { get; set; }

Property Value

double

TickPlacement

Gets or sets a value that indicates where to draw tick marks in relation to the track.

public TickPlacement TickPlacement { get; set; }

Property Value

TickPlacement

Ticks

Defines the ticks to be drawn on the tick bar.

public AvaloniaList<double>? Ticks { get; set; }

Property Value

AvaloniaList<double>

Track

Gets the Track part of the Slider.

protected Track? Track { get; }

Property Value

Track

Methods

OnApplyTemplate(TemplateAppliedEventArgs)

Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.

protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

Parameters

e TemplateAppliedEventArgs

The event args.

OnCreateAutomationPeer()

Returns a new, type-specific AutomationPeer implementation for the control.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer

The type-specific AutomationPeer implementation.

OnKeyDown(KeyEventArgs)

Called before the KeyDown event occurs.

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

The event args.

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)

Parameters

change AvaloniaPropertyChangedEventArgs

The property change details.

OnThumbDragCompleted(VectorEventArgs)

Called when user stop dragging the Thumb.

protected virtual void OnThumbDragCompleted(VectorEventArgs e)

Parameters

e VectorEventArgs

OnThumbDragStarted(VectorEventArgs)

Called when user start dragging the Thumb.

protected virtual void OnThumbDragStarted(VectorEventArgs e)

Parameters

e VectorEventArgs

UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception?)

Called to update the validation state for properties for which data validation is enabled.

protected override void UpdateDataValidation(AvaloniaProperty property, BindingValueType state, Exception? error)

Parameters

property AvaloniaProperty

The property.

state BindingValueType

The current data binding state.

error Exception

The current data binding error, if any.