In This Article

RangeSlider Class

A control that lets a user select a range of values from within a broader range of available values by moving one or more thumbs along a track.

public class RangeSlider : Control, IOrientedElement
Inheritance:
object Visual UIElement FrameworkElement Control object
Implements:
IOrientedElement

Constructors

RangeSlider()

Initializes a new instance of the class.

public RangeSlider()

Properties

IsDirectionReversed

When true, values are associated with the opposite side of the control than the default.

public bool IsDirectionReversed { get; set; }

Property Value

bool:

true for values to display right-to-left (horizontal) or top-to-bottom (vertical); otherwise, false for values to display left-to-right (horizontal) or bottom-to-top (vertical). The default value is false.

IsInclusive

Whether the range defined by the slider is inclusive of the points between RangeStart and RangeEnd.

public bool IsInclusive { get; set; }

Property Value

bool:

The default value is true.

IsMarkContentVisible

Indicates if the content of a mark is visible.

public bool IsMarkContentVisible { get; set; }

Property Value

bool:

The default value is true.

Remarks

An individual RangeSliderMark can override this value by setting IsContentVisible.

IsMarkTrackDecorationVisible

Indicates if the track decoration of a mark is visible.

public bool IsMarkTrackDecorationVisible { get; set; }

Property Value

bool:

The default value is true.

Remarks

An individual RangeSliderMark can override this value by setting IsTrackDecorationVisible.

IsRangeDragEnabled

Whether the range between multiple values can be dragged to move all values together.

public bool IsRangeDragEnabled { get; set; }

Property Value

bool:

true to allow all the range to be dragged; otherwise, false. The default value is false.

Remarks

Only applicable when IsRanged is set to true.

IsRangeEditEnabled

Whether to enable the ability to add or remove range values by holding the Ctrl key when pressing the pointer.

public bool IsRangeEditEnabled { get; set; }

Property Value

bool:

The default value is false.

Remarks

Only applicable when IsRanged is set to true.

See Also

IsRanged

Whether the slider is used to define a range of values.

public bool IsRanged { get; set; }

Property Value

bool:

true to allow a range of values to be selected; otherwise, false to allow selecting a single value. The default value is true.

IsSnapToTickEnabled

Indicates whether thumb values automatically move to the closest tick mark.

public bool IsSnapToTickEnabled { get; set; }

Property Value

bool:

The default value is false.

Remarks

Only applicable when TickFrequency is set to a non-zero value..

IsTrackEdgeAlignedWithValue

Indicates if the edges of the track align with the minimum and maximum values.

public bool IsTrackEdgeAlignedWithValue { get; set; }

Property Value

bool:

The default value is false.

Remarks

When false, the track edges will extend the full width and align with the outside edge of a thumb. When true, the track edges are aligned with the position for the minimum and maximum values and will align with the center of a thumb.

LargeChange

The large increment value.

public double LargeChange { get; set; }

Property Value

double:

The default value is 10.

MarkContentPlacement

Indicates the placement of content for a mark.

public RangeSliderPlacement MarkContentPlacement { get; set; }

Property Value

RangeSliderPlacement:

The default value is BottomRight.

Remarks

An individual RangeSliderMark can override this value by setting ContentPlacement.

MarkElements

A collection of all the marks represented on the slider.

public ObservableCollection<RangeSliderMark>? MarkElements { get; set; }

Property Value

ObservableCollection<RangeSliderMark>

MarkSnapDistance

The minimum distance between a dragged thumb and a mark before the thumb snaps to the same value as the mark.

public double MarkSnapDistance { get; set; }

Property Value

double:

Set to 0 to disable snapping to marks. The default value is 0.

Remarks

An individual RangeSliderMark can override this value by setting SnapDistance.

MarkStyle

The style to be used for the marks.

public Style? MarkStyle { get; set; }

Property Value

Style

Marks

Defines the individual values for RangeSliderMark instances that will be automatically created and added to MarkElements.

[Bindable(true)]
public DoubleCollection? Marks { get; set; }

Property Value

DoubleCollection:

The default value is null.

Remarks

Set either the Marks or MarkElements property, but do not set both. Explicitly setting the Marks property will rebuild the MarkElements. Use the MarkElements property if individual marks need to be configured beyond their default values.

Maximum

The maximum possible value.

public double Maximum { get; set; }

Property Value

double:

The default value is 100.

Minimum

The minimum possible value.

public double Minimum { get; set; }

Property Value

double:

The default value is 0.

MinimumStepsBetweenThumbs

The minimum number of "steps" between thumbs, which can be used to prevent overlap. A single "step", in this context, is typically defined by StepFrequency. If IsSnapToTickEnabled and TickFrequency is assigned a positive value then a "step" will be defined by TickFrequency instead.

public int MinimumStepsBetweenThumbs { get; set; }

Property Value

int:

The default value is 0.

Remarks

This property has no affect when OverlapKind is set to Overlap since it would other prevent thumbs from being dragged over each other.

This property is not supported when Ticks is set to a non-null value (i.e., custom tick values are defined).

Orientation

The orientation of the control.

public Orientation Orientation { get; set; }

Property Value

Orientation:

The default value is Horizontal.

OverlapKind

The kind of thumb overlapping to support.

public RangeSliderOverlapKind OverlapKind { get; set; }

Property Value

RangeSliderOverlapKind:

The default value is Overlap.

RangeEditMaximumValueCount

The maximum number of allowed values in the Values collection when range editing is enabled.

public int RangeEditMaximumValueCount { get; set; }

Property Value

int:

The default value is Int32.MaxValue.

Remarks

Only applicable when IsRangeEditEnabled is set to true.

See Also

RangeEditMinimumValueCount

The minimum number of allowed values in the Values collection when range editing is enabled.

public int RangeEditMinimumValueCount { get; set; }

Property Value

int:

The default value is 1.

Remarks

Only applicable when IsRangeEditEnabled is set to true.

See Also

RangeEnd

The upper limit of the currently selected range.

public double RangeEnd { get; set; }

Property Value

double

RangeStart

The lower limit of the currently selected range.

public double RangeStart { get; set; }

Property Value

double

RoundingDecimalPlace

The rounding decimal place.

public int? RoundingDecimalPlace { get; set; }

Property Value

int?:

The rounding decimal place, which is a value between 0 and 15. Set to nullto disable rounding. The default value is 8.

SmallChange

The small increment value.

public double SmallChange { get; set; }

Property Value

double:

The default value is 1.

StepFrequency

The interval between steps.

public double StepFrequency { get; set; }

Property Value

double:

The default value is 0.0.

ThumbStyle

The style to be used for the thumbs.

public Style? ThumbStyle { get; set; }

Property Value

Style

ThumbValueBadgeDisplayKinds

Indicates when the value badge of a thumb is displayed.

public RangeSliderValueBadgeDisplayKinds ThumbValueBadgeDisplayKinds { get; set; }

Property Value

RangeSliderValueBadgeDisplayKinds:

The default value is Interacting.

ThumbValueBadgePlacement

Indicates the placement of a thumb value badge.

public RangeSliderPlacement ThumbValueBadgePlacement { get; set; }

Property Value

RangeSliderPlacement:

The default value is TopLeft.

Remarks

An individual RangeSliderThumb can override this value by setting ValueBadgePlacement.

TickBarReservedSpace

The reserved space to be used for tick bar controls.

public double TickBarReservedSpace { get; }

Property Value

double

TickBarStyle

The style to be used for the tickbars.

public Style? TickBarStyle { get; set; }

Property Value

Style

TickFrequency

The interval between ticks.

public double TickFrequency { get; set; }

Property Value

double:

The default value is 0.0.

TickPlacement

Indicates whether to draw tick marks in relation to the track.

public TickPlacement TickPlacement { get; set; }

Property Value

TickPlacement:

The default value is None.

Ticks

Defines the ticks to be drawn on the tick bar.

[Bindable(true)]
public DoubleCollection? Ticks { get; set; }

Property Value

DoubleCollection:

The default value is null.

Remarks

When not null, TickFrequency is ignored and only the values in this collection are drawn. Requires that TickPlacement is not set to None.

TrackAscent

The ascent of the track, which is the length of the dimension perpendicular to the x-axis (i.e., the track height of a horizontal slider or track width of a vertical slider).

public double TrackAscent { get; set; }

Property Value

double:

The default value is 4.

ValueContentConverter

The converter, if any, to be applied to ValueContentConverter and ValueContentConverter properties.

public IValueConverter? ValueContentConverter { get; set; }

Property Value

IValueConverter

See Also

ValueFormat

The format, if any, to be applied to ValueFormat and ValueFormat properties.

public string? ValueFormat { get; set; }

Property Value

string

Remarks

This value can be defined as a numeric (e.g., "G") or composite (e.g., "{0:G}") format string.

Values

A collection of all the value points represented on the slider.

public ObservableCollection<double>? Values { get; set; }

Property Value

ObservableCollection<double>

Methods

CreateThumb()

Creates a RangeSliderThumb to represent a value on the slider.

protected RangeSliderThumb CreateThumb()

Returns

RangeSliderThumb

OnApplyTemplate()

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

public override void OnApplyTemplate()

OnCreateAutomationPeer()

Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific AutomationPeer implementation.

ToString()

Returns the string representation of this object.

public override string ToString()

Returns

string:

The string representation of this object.

Fields

IsDirectionReversedProperty

Defines the IsDirectionReversed property.

public static readonly DependencyProperty IsDirectionReversedProperty

IsInclusiveProperty

Defines the IsInclusive property.

public static readonly DependencyProperty IsInclusiveProperty

IsMarkContentVisibleProperty

Defines the IsMarkContentVisible property.

public static readonly DependencyProperty IsMarkContentVisibleProperty

IsMarkTrackDecorationVisibleProperty

Defines the IsMarkTrackDecorationVisible property.

public static readonly DependencyProperty IsMarkTrackDecorationVisibleProperty

IsRangeDragEnabledProperty

Defines the IsRangeDragEnabled property.

public static readonly DependencyProperty IsRangeDragEnabledProperty

IsRangeEditEnabledProperty

Defines the IsRangeEditEnabled property.

public static readonly DependencyProperty IsRangeEditEnabledProperty

IsRangedProperty

Defines the IsRanged property.

public static readonly DependencyProperty IsRangedProperty

IsSnapToTickEnabledProperty

Defines the IsSnapToTickEnabled property.

public static readonly DependencyProperty IsSnapToTickEnabledProperty

IsTrackEdgeAlignedWithValueProperty

Defines the IsTrackEdgeAlignedWithValue property.

public static readonly DependencyProperty IsTrackEdgeAlignedWithValueProperty

LargeChangeProperty

Defines the LargeChange property.

public static readonly DependencyProperty LargeChangeProperty

MarkContentPlacementProperty

Defines the MarkContentPlacement property.

public static readonly DependencyProperty MarkContentPlacementProperty

MarkElementsProperty

Defines the MarkElements property.

public static readonly DependencyProperty MarkElementsProperty

MarkSnapDistanceProperty

Defines the MarkSnapDistance property.

public static readonly DependencyProperty MarkSnapDistanceProperty

MarkStyleProperty

Defines the MarkStyle property.

public static readonly DependencyProperty MarkStyleProperty

MarksProperty

Defines the Marks property.

public static readonly DependencyProperty MarksProperty

MaximumProperty

Defines the Maximum property.

public static readonly DependencyProperty MaximumProperty

MinimumProperty

Defines the Minimum property.

public static readonly DependencyProperty MinimumProperty

MinimumStepsBetweenThumbsProperty

Defines the MinimumStepsBetweenThumbs property.

public static readonly DependencyProperty MinimumStepsBetweenThumbsProperty

OrientationProperty

Defines the Orientation property.

public static readonly DependencyProperty OrientationProperty

OverlapKindProperty

Defines the OverlapKind property.

public static readonly DependencyProperty OverlapKindProperty

RangeEditMaximumValueCountProperty

Defines the RangeEditMaximumValueCount property.

public static readonly DependencyProperty RangeEditMaximumValueCountProperty

RangeEditMinimumValueCountProperty

Defines the RangeEditMinimumValueCount property.

public static readonly DependencyProperty RangeEditMinimumValueCountProperty

RangeEndProperty

Defines the RangeEnd property.

public static readonly DependencyProperty RangeEndProperty

RangeStartProperty

Defines the RangeStart property.

public static readonly DependencyProperty RangeStartProperty

RoundingDecimalPlaceProperty

Defines the RoundingDecimalPlace property.

public static readonly DependencyProperty RoundingDecimalPlaceProperty

SmallChangeProperty

Defines the SmallChange property.

public static readonly DependencyProperty SmallChangeProperty

StepFrequencyProperty

Defines the StepFrequency property.

public static readonly DependencyProperty StepFrequencyProperty

ThumbStyleProperty

Defines the ThumbStyle property.

public static readonly DependencyProperty ThumbStyleProperty

ThumbValueBadgeDisplayKindsProperty

Defines the ThumbValueBadgeDisplayKinds property.

public static readonly DependencyProperty ThumbValueBadgeDisplayKindsProperty

ThumbValueBadgePlacementProperty

Defines the ThumbValueBadgePlacement property.

public static readonly DependencyProperty ThumbValueBadgePlacementProperty

TickBarReservedSpaceProperty

Defines the TickBarReservedSpace property.

public static readonly DependencyProperty TickBarReservedSpaceProperty

TickBarStyleProperty

Defines the TickBarStyle property.

public static readonly DependencyProperty TickBarStyleProperty

TickFrequencyProperty

Defines the TickFrequency property.

public static readonly DependencyProperty TickFrequencyProperty

TickPlacementProperty

Defines the TickPlacement property.

public static readonly DependencyProperty TickPlacementProperty

TicksProperty

Defines the Ticks property.

public static readonly DependencyProperty TicksProperty

TrackAscentProperty

Defines the TrackAscent property.

public static readonly DependencyProperty TrackAscentProperty

ValueContentConverterProperty

Defines the ValueContentConverter property.

public static readonly DependencyProperty ValueContentConverterProperty

ValueFormatProperty

Defines the ValueFormat property.

public static readonly DependencyProperty ValueFormatProperty

ValuesProperty

Defines the Values property.

public static readonly DependencyProperty ValuesProperty

Extension Methods