Simple Range Sliders - SaneDevelopment/WPF-Controls GitHub Wiki
SimpleNumericRangeSlider and SimpleDateTimeRangeSlider are controls similar to System.Windows.Controls.Slider, but let the user select two values (or range) instead of one.
/images/SimpleNumericRangeSliderSample.gif
SimpleDateTimeRangeSlider is a control absolutely similar to SimpleNumericRangeSlider, but has DateTime values of some properties (such as Minimum, Maximum, StartValue, EndValue and so on) instead of double values.
/images/SimpleDateTimeRangeSliderSample.gif
User can change values by moving a Thumb or by pressing a keys on keyboard:
| Key gesture | Activated command |
|---|---|
PageUp |
IncreaseRangeLarge |
LeftCtrl + PageUp |
IncreaseStartLarge |
RightCtrl + PageUp |
IncreaseEndLarge |
PageDown |
DecreaseRangeLarge |
LeftCtrl + PageDown |
DecreaseStartLarge |
RightCtrl + PageDown |
DecreaseEndLarge |
Up Arrow, Right Arrow |
IncreaseRangeSmall |
LeftCtrl + Up Arrow, LeftCtrl + Right Arrow |
IncreaseStartSmall |
RightCtrl + Up Arrow, RightCtrl + Right Arrow |
IncreaseEndSmall |
Down Arrow, Left Arrow |
DecreaseRangeSmall |
LeftCtrl + Down Arrow, LeftCtrl + Left Arrow |
DecreaseStartSmall |
RightCtrl + Down Arrow, RightCtrl + Left Arrow |
DecreaseEndSmall |
Home |
MinimizeRangeValue |
LeftCtrl + Home |
MinimizeStartValue |
RightCtrl + Home |
MinimizeEndValue |
End |
MaximizeRangeValue |
LeftCtrl + End |
MaximizeStartValue |
RightCtrl + End |
MaximizeEndValue |
Properties
Common properties for all range sliders:
| Property | Description |
|---|---|
AutoToolTipFormat |
Gets or sets the standard or custom format string for any value of range. Ignored if AutoToolTipValueConverter is set. (Inherited from SimpleRangeSlider<T, TInterval>) |
AutoToolTipPlacement |
Gets or sets whether a tooltip that contains the current value of the slider displays when the any thumb is pressed. If a tooltip is displayed, this property also specifies the placement of the tooltip. (Inherited from SimpleRangeSlider<T, TInterval>) |
AutoToolTipValueConverter |
Gets or sets the IRangeValueToStringConverter<T> that converts any value of range (StartValue, EndValue, etc.) to the string showing in tooltip. If not null then AutoToolTipFormat ignoring. (Inherited from SimpleRangeSlider<T, TInterval>) |
AutoToolTipValueConverterParameter |
Gets or sets the additional parameter for the IRangeValueToStringConverter<T>. Designed as a parameter for the specific converter. (Inherited from SimpleRangeSlider<T, TInterval>) |
Delay |
Gets or sets the amount of time in milliseconds that a RepeatButton waits, while it is pressed, before a command to move the thumb executes, such as a Decrease*Large command. (Inherited from SimpleRangeSlider<T, TInterval>) |
EndReservedSpace |
Gets the size of space reserved between right/bottom edge of the control and right/bottom end of embedded TickBar. Evaluates from thumb's width/height. (Inherited from SimpleRangeSlider<T, TInterval>) |
EndValue |
Gets or sets the current end value of the range element. |
Interval |
Gets or sets the amount of time in milliseconds between increase or decrease commands when a user clicks the RepeatButton of a slider. (Inherited from SimpleRangeSlider<T, TInterval>) |
IsDragRangeEnabled |
Gets or sets a value indicating whether RangeThumb can be draged thereby the whole RangeValue changes. If false, user can move only StartThumb or EndThumb independently. (Inherited from SimpleRangeSlider<T, TInterval>) |
IsRaiseValueChangedWhileDragging |
Gets or sets a value indicating whether the event ValueChanged raises while dragging any of thumbs. If false, the event raises only right after dragging stoped (e.g. user releases mouse button). (Inherited from SimpleRangeSlider<T, TInterval>) |
IsRangeDragging |
Gets a value indicating whether this element is in process of dragging (any of thumbs) now. (Inherited from SimpleRangeSlider<T, TInterval>) |
IsSingleValue |
Gets or sets a value indicating whether this element is behaves like a ordinary System.Windows.Controls.Slider. That is, StartValue equals to EndValue and RangeVale equals to 0. (Inherited from RangeBaseControl<T, TInterval>) |
IsSnapToTickEnabled |
Gets or sets a value that indicates whether the slider automatically moves the thumb to the closest tick mark. (Inherited from SimpleRangeSlider<T, TInterval>) |
LargeChange |
Gets or sets a value to be added to or subtracted from the value of a control when any of the *Large command raises. |
Maximum |
Gets or sets the highest possible value of the range element. |
Minimum |
Gets or sets the minimum possible value of the range element. |
MinRangeValue |
Gets or sets the minimum possible value of the RangeValue. |
Orientation |
Gets or sets the orientation of a slider. (Inherited from SimpleRangeSlider<T, TInterval>) |
RangeValue |
Gets the current range value, i.e. EndValue - StartValue. (Inherited from RangeBaseControl<T, TInterval>) |
SmallChange |
Gets or sets a value to be added to or subtracted from the value of a control when any of the *Small command raises. |
StartReservedSpace |
Gets the size of space reserved between left/top edge of the control and left/top end of embedded TickBar. Evaluates from thumb's width/height. (Inherited from SimpleRangeSlider<T, TInterval>) |
StartValue |
Gets or sets the current start value of the range element. |
TickFrequency |
Gets or sets the interval between tick marks. |
TickLabelConverter |
Gets or sets the IDoubleToStringConverter that converts tick value to the string. If not set then uses CultureInfo.CurrentCulture.NumberFormat format provider. |
TickLabelConverterParameter |
Gets or sets the additional parameter for the IDoubleToStringConverter. Designed as a parameter for the specific converter. |
TickPlacement |
Gets or sets the position of tick marks with respect to the track of the slider. (Inherited from SimpleRangeSlider<T, TInterval>) |
Properties specific for SimpleNumericRangeSlider:
| Property | Description |
|---|---|
AutoToolTipPrecision |
Gets or sets the number of decimal places to use in double values converted to strings showing in tooltip. Ignored if AutoToolTipValueConverter is set. |
Ticks |
Gets or sets the positions of the tick marks to display for a slider. This is collection of double values: DoubleCollection. |
Properties specific for SimpleDateTimeRangeSlider:
| Property | Description |
|---|---|
MaximumAsDouble |
Gets the double value of Maximum property. This is a value of DateTime.Ticks converted to double. Can be used in scenarios of binding to double-typed dependency properties of other controls (such as ordinary System.Windows.Controls.Slider). |
MinimumAsDouble |
Gets the double value of Minimum property. This is a value of DateTime.Ticks converted to double. Can be used in scenarios of binding to double-typed dependency properties of other controls (such as ordinary System.Windows.Controls.Slider). |
TickFrequencyAsDouble |
Gets the double value of TickFrequency property. This is a value of DateTime.Ticks converted to double. Can be used in scenarios of binding to double-typed dependency properties of other controls (such as ordinary System.Windows.Controls.Slider) |
Ticks |
Gets or sets the positions of the tick marks to display for a slider. This is collection of DateTime values: DateTimeCollection |
TicksAsDouble |
Gets the positions of the tick marks to display for a slider. This is collection of double values: DoubleCollection, copied from Ticks property (via converting DateTime.Ticks to double). Can be used in scenarios of binding to double-typed dependency properties of other controls (such as ordinary System.Windows.Controls.Primitives.TickBar.Ticks). |
Commands
You can manipulate range slider values by the following commands via command binding in XAML or code behind.
| Command | Description |
|---|---|
DecreaseEndLarge |
Decreases the EndValue of the slider by the same amount as the LargeChange property. |
DecreaseEndSmall |
Decreases the EndValue of the slider by the same amount as the SmallChange property. |
DecreaseRangeLarge |
Decreases the both StartValue and EndValue of the slider by the same amount as the LargeChange property. |
DecreaseRangeSmall |
Decreases the both StartValue and EndValue of the slider by the same amount as the SmallChange property. |
DecreaseStartLarge |
Decreases the StartValue of the slider by the same amount as the LargeChange property. |
DecreaseStartSmall |
Decreases the StartValue of the slider by the same amount as the SmallChange property. |
IncreaseEndLarge |
Increases the EndValue of the slider by the same amount as the LargeChange property. |
IncreaseEndSmall |
Increases the EndValue of the slider by the same amount as the SmallChange property. |
IncreaseRangeLarge |
Increases the both StartValue and EndValue of the slider by the same amount as the LargeChange property. |
IncreaseRangeSmall |
Increases the both StartValue and EndValue of the slider by the same amount as the SmallChange property. |
IncreaseStartLarge |
Increases the StartValue of the slider by the same amount as the LargeChange property. |
IncreaseStartSmall |
Increases the StartValue of the slider by the same amount as the SmallChange property. |
MaximizeEndValue |
Sets the EndValue of the slider to the Maximum value. |
MaximizeRangeValue |
Sets the EndValue of the slider to the Maximum value and increases the StartValue by the same amount. In other words, shifts the whole range to the Maximum. |
MaximizeStartValue |
Sets the StartValue of the slider to the Maximum value. |
MinimizeEndValue |
Sets the EndValue of the slider to the Minimum value. |
MinimizeRangeValue |
Sets the StartValue of the slider to the Minimum value and decreases the EndValue by the same amount. In other words, shifts the whole range to the Minimum. |
MinimizeStartValue |
Sets the StartValue of the slider to the Minimum value. |
Events
| Event | Description |
|---|---|
EndValueChanged |
Occurs when the EndValue changes. (Inherited from RangeBaseControl<T, TInterval>.) |
IsRangeDraggingChanged |
Occurs when the IsRangeDragging changes. (Inherited from RangeBaseControl<T, TInterval>.) |
RangeDragCompleted |
Occurs when dragging of any of thumbs stoped (e.g. user releases mouse button). (Inherited from RangeBaseControl<T, TInterval>.) |
RangeValueChanged |
Occurs when the RangeValue changes. (Inherited from RangeBaseControl<T, TInterval>.) |
StartValueChanged |
Occurs when the StartValue changes. (Inherited from RangeBaseControl<T, TInterval>.) |
ValueChanged |
Occurs when any (or both) of the StartValue and EndValue changes. (Inherited from RangeBaseControl<T, TInterval>.) |