Skip to content

Support to select a range of values.

cs
public class TwoWayRangeBase : Control
cs
[DefaultEvent("ValueChanged"), DefaultProperty("Value")]
[TemplatePart(Name = ElementTrack, Type = typeof(Track))]
public class RangeSlider : TwoWayRangeBase

Attributes

PropertyDescriptionDefault ValueRemarks
MinimumMinimum value0
MaximumMaximum0
ValueStartStart of the selected range0
ValueEndThe end of the selected range0
LargeChangeSingle maximum change value1
SmallChangeSingle minimum change value0.1
OrientationOrientationOrientation.Horizontal
IsDirectionReversedIs it reversedfalse
DelayWaiting time before repeated clicks
IntervalRepeated click trigger time interval
AutoToolTipPlacementAuto ToolTipPlacementAutoToolTipPlacement.None
AutoToolTipPrecisionAutomatic tool tip decimal places0
IsSnapToTickEnabledWhether to automatically move the Thumb to the nearest tick markfalse
TickPlacementThe position of the tick markTickPlacement.None
TickFrequencyThe interval between tick marks1
TicksTick Line Drawing Collection
IsMoveToPointEnabledWhether the Thumb can be moved to the position clicked by the mouse immediatelyfalse

Events

NameDescription
ValueChangedTriggered when the selected range changes

Case

xml
<StackPanel Margin="32" Orientation="Horizontal">
    <StackPanel>
        <hc:RangeSlider Width="400" IsSnapToTickEnabled="True" ValueStart="2" ValueEnd="8"/>
        <hc:RangeSlider Width="400" IsSnapToTickEnabled="True" ValueEnd="3" Margin="0,32,0,0" IsEnabled="False"/>
        <hc:RangeSlider Width="400" hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Top" IsSnapToTickEnabled="True" Maximum="100" ValueEnd="60" TickFrequency="10" TickPlacement="BottomRight" Margin="0,32,0,0"/>
        <hc:RangeSlider Width="400" hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Bottom" hc:TipElement.StringFormat="#0.00" ValueEnd="5" TickPlacement="Both" Margin="0,32,0,0"/>
    </StackPanel>
    <StackPanel Margin="32,0,0,0" Orientation="Horizontal">
        <hc:RangeSlider Height="400" IsSnapToTickEnabled="True" ValueEnd="8" Orientation="Vertical"/>
        <hc:RangeSlider Height="400" IsSnapToTickEnabled="True" ValueEnd="3" Margin="32,0,0,0" IsEnabled="False" Orientation="Vertical"/>
        <hc:RangeSlider Height="400" hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Left" IsSnapToTickEnabled="True" Maximum="100" ValueEnd="60" TickFrequency="10" TickPlacement="BottomRight" Margin="32,0,0,0" Orientation="Vertical"/>
        <hc:RangeSlider Height="400" hc:TipElement.Visibility="Visible" hc:TipElement.Placement="Right" hc:TipElement.StringFormat="#0.00" ValueEnd="5" TickPlacement="Both" Margin="32,0" Orientation="Vertical"/>
    </StackPanel>
</StackPanel>

RangeSlider

Released under the MIT License.