Loading...
Loading...
Compare original and translation side by side
<Window x:Class="RangeSliderDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:editors="clr-namespace:Syncfusion.Windows.Controls.Input;assembly=Syncfusion.SfInput.Wpf">
<Grid>
<!-- Basic Range Slider -->
<editors:SfRangeSlider
Width="400"
Minimum="0"
Maximum="100"
RangeStart="20"
RangeEnd="80"
ShowRange="True"
TickPlacement="BottomRight"
TickFrequency="10"
ShowValueLabels="True" />
</Grid>
</Window>using Syncfusion.Windows.Controls.Input;
using System.Windows;
namespace RangeSliderDemo
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// Create range slider programmatically
SfRangeSlider rangeSlider = new SfRangeSlider()
{
Width = 400,
Minimum = 0,
Maximum = 100,
RangeStart = 20,
RangeEnd = 80,
ShowRange = true,
TickPlacement = TickPlacement.BottomRight,
TickFrequency = 10,
ShowValueLabels = true
};
// Add to container
this.Content = rangeSlider;
}
}
}<Window x:Class="RangeSliderDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:editors="clr-namespace:Syncfusion.Windows.Controls.Input;assembly=Syncfusion.SfInput.Wpf">
<Grid>
<!-- Basic Range Slider -->
<editors:SfRangeSlider
Width="400"
Minimum="0"
Maximum="100"
RangeStart="20"
RangeEnd="80"
ShowRange="True"
TickPlacement="BottomRight"
TickFrequency="10"
ShowValueLabels="True" />
</Grid>
</Window>using Syncfusion.Windows.Controls.Input;
using System.Windows;
namespace RangeSliderDemo
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// Create range slider programmatically
SfRangeSlider rangeSlider = new SfRangeSlider()
{
Width = 400,
Minimum = 0,
Maximum = 100,
RangeStart = 20,
RangeEnd = 80,
ShowRange = true,
TickPlacement = TickPlacement.BottomRight,
TickFrequency = 10,
ShowValueLabels = true
};
// Add to container
this.Content = rangeSlider;
}
}
}<!-- Price range selector with currency formatting -->
<editors:SfRangeSlider
Width="350"
Minimum="0"
Maximum="1000"
RangeStart="100"
RangeEnd="500"
ShowRange="True"
TickFrequency="100"
TickPlacement="BottomRight"
ShowValueLabels="True"
ToolTipFormat="C0"
ThumbToolTipPlacement="TopLeft"
SnapsTo="Ticks"
RangeChanged="PriceRangeSlider_RangeChanged" /><!-- Price range selector with currency formatting -->
<editors:SfRangeSlider
Width="350"
Minimum="0"
Maximum="1000"
RangeStart="100"
RangeEnd="500"
ShowRange="True"
TickFrequency="100"
TickPlacement="BottomRight"
ShowValueLabels="True"
ToolTipFormat="C0"
ThumbToolTipPlacement="TopLeft"
SnapsTo="Ticks"
RangeChanged="PriceRangeSlider_RangeChanged" /><!-- Volume slider with minor ticks and snapping -->
<editors:SfRangeSlider
Width="300"
Minimum="0"
Maximum="100"
Value="50"
TickFrequency="10"
MinorTickFrequency="2"
TickPlacement="BottomRight"
SnapsTo="StepFrequency"
StepFrequency="5"
ShowValueLabels="True"
ThumbToolTipPlacement="TopLeft"
ToolTipFormat="N0" /><!-- Volume slider with minor ticks and snapping -->
<editors:SfRangeSlider
Width="300"
Minimum="0"
Maximum="100"
Value="50"
TickFrequency="10"
MinorTickFrequency="2"
TickPlacement="BottomRight"
SnapsTo="StepFrequency"
StepFrequency="5"
ShowValueLabels="True"
ThumbToolTipPlacement="TopLeft"
ToolTipFormat="N0" /><!-- Custom labels for date ranges -->
<editors:SfRangeSlider
Width="450"
Minimum="0"
Maximum="11"
RangeStart="2"
RangeEnd="8"
ShowRange="True"
ShowCustomLabels="True"
TickFrequency="1"
TickPlacement="BottomRight"
SnapsTo="Ticks">
<editors:SfRangeSlider.CustomLabels>
<editors:LabelItem Content="Jan" Position="0"/>
<editors:LabelItem Content="Feb" Position="1"/>
<editors:LabelItem Content="Mar" Position="2"/>
<editors:LabelItem Content="Apr" Position="3"/>
<editors:LabelItem Content="May" Position="4"/>
<editors:LabelItem Content="Jun" Position="5"/>
<editors:LabelItem Content="Jul" Position="6"/>
<editors:LabelItem Content="Aug" Position="7"/>
<editors:LabelItem Content="Sep" Position="8"/>
<editors:LabelItem Content="Oct" Position="9"/>
<editors:LabelItem Content="Nov" Position="10"/>
<editors:LabelItem Content="Dec" Position="11"/>
</editors:SfRangeSlider.CustomLabels>
</editors:SfRangeSlider><!-- Custom labels for date ranges -->
<editors:SfRangeSlider
Width="450"
Minimum="0"
Maximum="11"
RangeStart="2"
RangeEnd="8"
ShowRange="True"
ShowCustomLabels="True"
TickFrequency="1"
TickPlacement="BottomRight"
SnapsTo="Ticks">
<editors:SfRangeSlider.CustomLabels>
<editors:LabelItem Content="Jan" Position="0"/>
<editors:LabelItem Content="Feb" Position="1"/>
<editors:LabelItem Content="Mar" Position="2"/>
<editors:LabelItem Content="Apr" Position="3"/>
<editors:LabelItem Content="May" Position="4"/>
<editors:LabelItem Content="Jun" Position="5"/>
<editors:LabelItem Content="Jul" Position="6"/>
<editors:LabelItem Content="Aug" Position="7"/>
<editors:LabelItem Content="Sep" Position="8"/>
<editors:LabelItem Content="Oct" Position="9"/>
<editors:LabelItem Content="Nov" Position="10"/>
<editors:LabelItem Content="Dec" Position="11"/>
</editors:SfRangeSlider.CustomLabels>
</editors:SfRangeSlider><!-- Vertical orientation with reversed direction -->
<editors:SfRangeSlider
Height="300"
Minimum="-10"
Maximum="50"
Value="22"
Orientation="Vertical"
TickFrequency="10"
TickPlacement="TopLeft"
ShowValueLabels="True"
ThumbToolTipPlacement="TopLeft"
ToolTipFormat="N0"
IsDirectionReversed="False" /><!-- Vertical orientation with reversed direction -->
<editors:SfRangeSlider
Height="300"
Minimum="-10"
Maximum="50"
Value="22"
Orientation="Vertical"
TickFrequency="10"
TickPlacement="TopLeft"
ShowValueLabels="True"
ThumbToolTipPlacement="TopLeft"
ToolTipFormat="N0"
IsDirectionReversed="False" /><Window.Resources>
<!-- Custom thumb style -->
<Style x:Key="CustomThumbStyle" TargetType="Thumb">
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse Fill="#FF4CAF50"
Stroke="#FF2E7D32"
StrokeThickness="2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<editors:SfRangeSlider
Width="400"
Minimum="0"
Maximum="100"
RangeStart="30"
RangeEnd="70"
ShowRange="True"
ThumbStyle="{StaticResource CustomThumbStyle}"
ActiveTickStroke="#FF4CAF50"
TickStroke="#FFBDBDBD"
TickPlacement="BottomRight"
TickFrequency="10" /><Window.Resources>
<!-- Custom thumb style -->
<Style x:Key="CustomThumbStyle" TargetType="Thumb">
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse Fill="#FF4CAF50"
Stroke="#FF2E7D32"
StrokeThickness="2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<editors:SfRangeSlider
Width="400"
Minimum="0"
Maximum="100"
RangeStart="30"
RangeEnd="70"
ShowRange="True"
ThumbStyle="{StaticResource CustomThumbStyle}"
ActiveTickStroke="#FF4CAF50"
TickStroke="#FFBDBDBD"
TickPlacement="BottomRight"
TickFrequency="10" />MinimumMaximumRangeStartRangeEndShowRangeAllowRangeDragThumbIntervalMinimumMaximumRangeStartRangeEndShowRangeAllowRangeDragThumbIntervalTickFrequencyMinorTickFrequencyTickPlacementSnapsToStepFrequencyTickFrequencyMinorTickFrequencyTickPlacementSnapsToStepFrequencyShowValueLabelsShowCustomLabelsCustomLabelsLabelPlacementLabelOrientationValuePlacementShowValueLabelsShowCustomLabelsCustomLabelsLabelPlacementLabelOrientationValuePlacementThumbToolTipPlacementThumbToolTipPrecisionToolTipFormatToolTipDisplayModeToolTipStyleThumbToolTipPlacementThumbToolTipPrecisionToolTipFormatToolTipDisplayModeToolTipStyleOrientationIsDirectionReversedOrientationIsDirectionReversedMoveToPointMoveToPointThumbStyleActiveTrackStyleInactiveTrackStyleActiveTickStrokeTickStrokeThumbStyleActiveTrackStyleInactiveTrackStyleActiveTickStrokeTickStrokeundefinedundefined
Add XML namespace in XAML:
```xaml
xmlns:editors="clr-namespace:Syncfusion.Windows.Controls.Input;assembly=Syncfusion.SfInput.Wpf"
在XAML中添加XML命名空间:
```xaml
xmlns:editors="clr-namespace:Syncfusion.Windows.Controls.Input;assembly=Syncfusion.SfInput.Wpf"