How can i style a Slider control for wpf in a way like in figure
Any similar samples would be appreciated .
I tried the below code
<Style x:Key="SliderThumbStyle" TargetType="Thumb">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="false"/>
<Setter Property="Height" Value="18"/>
<Setter Property="Width" Value="18"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse Stroke="Black"
StrokeThickness="1"
Name="Ellipse"
Fill="OrangeRed" />
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Ellipse" Property="Fill" Value="Orange"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Ellipse" Property="Fill" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Slider" x:Key="AppSliderStyle">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" Name="row" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" Name="column" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Border Name="PART_Border"
BorderBrush="Black" BorderThickness="1"
Padding="2"
Grid.Row="1" Grid.Column="1"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Background="GreenYellow"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
<Track Name="PART_Track"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Grid.Row="1" Grid.Column="1"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}">
<Track.Thumb>
<Thumb Style="{StaticResource SliderThumbStyle}" />
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
And it produced this
Struggling to make color as diffeerent in left and right . What changes i ahve to do for doing that
Similar example :
Track bar /slider template for WPF
You need to edit style of Both RepeatButton
Result
create custom thumb / track bar / slider control template in WPF
Check the complete code here:
Click here for complete solution with source code