WinUI

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfRangeSlider

    Show / Hide Table of Contents

    Class SfRangeSlider

    Range Slider is a highly interactive UI control, allowing users to select a smaller range from a larger data set. The range can be selected by moving the thumb along the track. It provides rich features such as labels, ticks, dividers, thumb, and tooltip.

    Inheritance
    System.Object
    SliderBase
    SfRangeSlider
    Implements
    System.IDisposable
    Inherited Members
    SliderBase.MinimumProperty
    SliderBase.MaximumProperty
    SliderBase.ActiveTrackHeightProperty
    SliderBase.InactiveTrackHeightProperty
    SliderBase.ActiveTrackFillProperty
    SliderBase.InactiveTrackFillProperty
    SliderBase.ThumbBackgroundProperty
    SliderBase.ThumbHeightProperty
    SliderBase.ThumbWidthProperty
    SliderBase.ThumbStyleProperty
    SliderBase.ActiveTrackStyleProperty
    SliderBase.InactiveTrackStyleProperty
    SliderBase.StepFrequencyProperty
    SliderBase.ThumbTypeProperty
    SliderBase.ThumbOverlayFillProperty
    SliderBase.ThumbOverlayRadiusProperty
    SliderBase.IntervalProperty
    SliderBase.MinorTicksPerIntervalProperty
    SliderBase.ShowTicksProperty
    SliderBase.ActiveMajorTickStyleProperty
    SliderBase.ActiveMinorTickStyleProperty
    SliderBase.MajorTickStyleProperty
    SliderBase.MinorTickStyleProperty
    SliderBase.MajorTickLengthProperty
    SliderBase.MinorTickLengthProperty
    SliderBase.MaximumLabelsCountProperty
    SliderBase.ShowLabelsProperty
    SliderBase.ActiveLabelTemplateProperty
    SliderBase.LabelTemplateProperty
    SliderBase.TickPlacementProperty
    SliderBase.TickOffsetProperty
    SliderBase.LabelPlacementProperty
    SliderBase.LabelOffsetProperty
    SliderBase.IsInversedProperty
    SliderBase.ShowDividersProperty
    SliderBase.DividerFillProperty
    SliderBase.DividerStrokeProperty
    SliderBase.DividerStrokeThicknessProperty
    SliderBase.DividerHeightProperty
    SliderBase.DividerWidthProperty
    SliderBase.DividerTemplateProperty
    SliderBase.ActiveDividerTemplateProperty
    SliderBase.ShowToolTipProperty
    SliderBase.ToolTipTemplateProperty
    SliderBase.ToolTipFormatProperty
    SliderBase.ToolTipStyleProperty
    SliderBase.OrientationProperty
    SliderBase.DisabledBrushProperty
    SliderBase.GenerateVisibleLabels()
    SliderBase.ValueToFactor(Double)
    SliderBase.FactorToValue(Double)
    SliderBase.OnPointerEntered(PointerRoutedEventArgs)
    SliderBase.Minimum
    SliderBase.Maximum
    SliderBase.ActiveTrackHeight
    SliderBase.InactiveTrackHeight
    SliderBase.ActiveTrackFill
    SliderBase.InactiveTrackFill
    SliderBase.ThumbBackground
    SliderBase.ThumbHeight
    SliderBase.ThumbWidth
    SliderBase.ThumbStyle
    SliderBase.ActiveTrackStyle
    SliderBase.InactiveTrackStyle
    SliderBase.StepFrequency
    SliderBase.ThumbType
    SliderBase.ThumbOverlayFill
    SliderBase.ThumbOverlayRadius
    SliderBase.Interval
    SliderBase.MinorTicksPerInterval
    SliderBase.ShowTicks
    SliderBase.ActiveMajorTickStyle
    SliderBase.ActiveMinorTickStyle
    SliderBase.MajorTickStyle
    SliderBase.MinorTickStyle
    SliderBase.MajorTickLength
    SliderBase.MinorTickLength
    SliderBase.MaximumLabelsCount
    SliderBase.ShowLabels
    SliderBase.ActiveLabelTemplate
    SliderBase.LabelTemplate
    SliderBase.TickPlacement
    SliderBase.TickOffset
    SliderBase.LabelPlacement
    SliderBase.LabelOffset
    SliderBase.IsInversed
    SliderBase.ShowDividers
    SliderBase.DividerFill
    SliderBase.DividerStroke
    SliderBase.DividerStrokeThickness
    SliderBase.DividerHeight
    SliderBase.DividerWidth
    SliderBase.DividerTemplate
    SliderBase.ActiveDividerTemplate
    SliderBase.ShowToolTip
    SliderBase.ToolTipTemplate
    SliderBase.ToolTipFormat
    SliderBase.ToolTipStyle
    SliderBase.Orientation
    SliderBase.DisabledBrush
    SliderBase.ThumbDragStarted
    SliderBase.ThumbDragCompleted
    Namespace: Syncfusion.UI.Xaml.Sliders
    Assembly: Syncfusion.Sliders.WinUI.dll
    Syntax
    public class SfRangeSlider : SliderBase, IDisposable
    Examples

    The below examples shows, how to initialize the range slider.

    <slider:SfRangeSlider Minimum="5"
                          Maximum="10"
                          RangeStart="6"
                          RangeEnd="9" />

    Constructors

    SfRangeSlider()

    Initializes a new instance of the SfRangeSlider class.

    Declaration
    public SfRangeSlider()
    Examples

    The below examples shows, how to initialize the range slider.

    <slider:SfRangeSlider Minimum="5"
                          Maximum="10"
                          RangeStart="6"
                          RangeEnd="9" />

    Fields

    CanDragActiveRangeProperty

    Identifies the CanDragActiveRange dependency property.

    Declaration
    public static readonly DependencyProperty CanDragActiveRangeProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for CanDragActiveRange dependency property.

    RangeEndProperty

    Identifies the RangeEnd dependency property.

    Declaration
    public static readonly DependencyProperty RangeEndProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for RangeEnd dependency property.

    RangeStartProperty

    Identifies the RangeStart dependency property.

    Declaration
    public static readonly DependencyProperty RangeStartProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for RangeStart dependency property.

    ToolTipOptionProperty

    Identifies the ToolTipOption dependency property.

    Declaration
    public static readonly DependencyProperty ToolTipOptionProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    The identifier for ToolTipOption dependency property.

    Properties

    CanDragActiveRange

    Gets or sets a value indicating whether to drag on active range instead of thumbs.

    Declaration
    public bool CanDragActiveRange { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if range dragging is enabled; otherwise, false.The default value is false.

    Examples
    <slider:SfRangeSlider RangeStart="30"
                          RangeEnd="70"
                          CanDragActiveRange="True"  />

    RangeEnd

    Gets or sets the end limit value of the slider range.

    Declaration
    public double RangeEnd { get; set; }
    Property Value
    Type Description
    System.Double

    End value of the slider range. The default value is 0.

    Examples
    <slider:SfRangeSlider RangeStart="30"
                          RangeEnd="70" />

    RangeStart

    Gets or sets the start limit value of the slider range.

    Declaration
    public double RangeStart { get; set; }
    Property Value
    Type Description
    System.Double

    Start value of the slider range. The default value is 0.

    Examples
    <slider:SfRangeSlider RangeStart="30"
                          RangeEnd="70" />

    ToolTipOption

    Gets or sets the value to show the tooltip on both thumbs or only on the active thumb.

    Declaration
    public TooltipOption ToolTipOption { get; set; }
    Property Value
    Type Description
    TooltipOption

    One of the enumeration values that specifies the tooltip displayed for both thumbs or only for the active thumb. The default is BothThumb.

    Examples
    <slider:SfRangeSlider RangeStart="30"
                          RangeEnd="70"
                          ToolTipOption="ActiveThumb" />

    Methods

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resource in SfRangeSlider.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Disposing range slider objects.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Used to indicate perform dispose or not.

    MeasureOverride(Size)

    Measures the size in layout required for child elements.

    Declaration
    protected override Size MeasureOverride(Size availableSize)
    Parameters
    Type Name Description
    Windows.Foundation.Size availableSize

    This size give to child elements.

    Returns
    Type Description
    Windows.Foundation.Size

    Return child element size.

    OnApplyTemplate()

    Invoke to render SfSlider class.

    Declaration
    protected override void OnApplyTemplate()
    Overrides
    SliderBase.OnApplyTemplate()

    OnCreateAutomationPeer()

    Declaration
    protected override AutomationPeer OnCreateAutomationPeer()
    Returns
    Type Description
    Microsoft.UI.Xaml.Automation.Peers.AutomationPeer

    OnGotFocus(RoutedEventArgs)

    Called when the control got focus.

    Declaration
    protected override void OnGotFocus(RoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.RoutedEventArgs e

    The routed event arguments.

    OnKeyDown(KeyRoutedEventArgs)

    Called when the key is pressed.

    Declaration
    protected override void OnKeyDown(KeyRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e

    The key routed event arguments.

    Overrides
    SliderBase.OnKeyDown(KeyRoutedEventArgs)

    OnLostFocus(RoutedEventArgs)

    Called when the control lost focus.

    Declaration
    protected override void OnLostFocus(RoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.RoutedEventArgs e

    The routed event arguments.

    Overrides
    SliderBase.OnLostFocus(RoutedEventArgs)

    OnPointerExited(PointerRoutedEventArgs)

    Called when the pointer exited.

    Declaration
    protected override void OnPointerExited(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    Pointer routed event args

    Overrides
    SliderBase.OnPointerExited(PointerRoutedEventArgs)

    OnPointerMoved(PointerRoutedEventArgs)

    Called when the pointer moved.

    Declaration
    protected override void OnPointerMoved(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    Pointer routed event args

    OnPointerPressed(PointerRoutedEventArgs)

    Called when the pointer pressed.

    Declaration
    protected override void OnPointerPressed(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    Pointer routed event args

    Overrides
    SliderBase.OnPointerPressed(PointerRoutedEventArgs)

    OnPointerReleased(PointerRoutedEventArgs)

    Called when the pointer released.

    Declaration
    protected override void OnPointerReleased(PointerRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e

    Pointer routed event args

    Overrides
    SliderBase.OnPointerReleased(PointerRoutedEventArgs)

    Events

    RangeValueChanged

    Event raised when the range start or end values are changed.

    Declaration
    public event EventHandler<RangeValueChangedEventArgs> RangeValueChanged
    Event Type
    Type Description
    System.EventHandler<RangeValueChangedEventArgs>
    Examples
    • XAML
    • C#
    <slider:SfRangeSlider RangeStart = "30"
                           RangeEnd="70"
                           RangeValueChanged="SfRangeSlider_RangeValueChanged" />

    The SfRangeSlider passes the old and new value of RangeStart and RangeEnd in arguments.

    private void SfRangeSlider_RangeValueChanged(object sender, RangeValueChangedEventArgs e)
    {
        var rangeStartOldValue = e.RangeStartOldValue;
        var rangeStartNewValue = e.RangeStartNewValue;
        var rangeEndOldValue = e.RangeEndOldValue;
        var rangeEndNewValue = e.RangeEndNewValue;
    }

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved