I followed this article Creating a Range Slider in WPF to create a great Range Slider using XAML and a bit of code behind. I am using this user control within my project. But I want to create a style for the control that has a custom thumb and track.
In my main XAML I use the control like this
<local:RangeSlider LowerValue="1" UpperValue="100" Style="{DynamicResource RangeSliderStyle1}"/>
the template I created looks like this
But I this doesn't apply the ThumbStyle2 to the thumbs in the Range Slider?
How would I do this so it works?
<Style x:Key="RangeSliderStyle1" TargetType="{x:Type local:RangeSlider}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type local:RangeSlider}"><Grid>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border><Canvas x:Name="graph_gutter_horizontal" UseLayoutRounding="False"><Canvas x:Name="Layer_2" Width="635" Canvas.Top="1.888" Canvas.Left="2.636" Height="6.001"><Path Width="617.206" Canvas.Top="0.501" Stretch="Fill" Canvas.Left="0.5" Height="5" Fill="#FF1A1A1A" Data="F1 M620.34269,5.3887 C620.34269,6.4887 619.44269,7.3887 618.34269,7.3887 L5.1357,7.3887 C4.0357,7.3887 3.1357,6.4887 3.1357,5.3887 L3.1357,4.3887 C3.1357,3.2887 4.0357,2.3887 5.1357,2.3887 L618.34269,2.3887 C619.44269,2.3887 620.34269,3.2887 620.34269,4.3887 z"/><Path Width="618.206" Canvas.Top="0" Stretch="Fill" Canvas.Left="0" Height="6.001" Data="F1 M5.135,1.888 C3.758,1.888 2.636,3.011 2.636,4.389 L2.636,4.389 2.636,5.388 C2.636,6.767 3.758,7.889 5.135,7.889 L5.135,7.889 618.34199,7.889 C619.72099,7.889 620.84299,6.767 620.84299,5.388 L620.84299,5.388 620.84299,4.389 C620.84299,3.011 619.72099,1.888 618.34199,1.888 L618.34199,1.888 z M3.636,5.388 L3.636,4.389 C3.636,3.561 4.308,2.889 5.135,2.889 L5.135,2.889 618.34199,2.889 C619.16899,2.889 619.84299,3.561 619.84299,4.389 L619.84299,4.389 619.84299,5.388 C619.84299,6.215 619.16899,6.889 618.34199,6.889 L618.34199,6.889 5.135,6.889 C4.308,6.889 3.636,6.215 3.636,5.388"><Path.Fill><LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"><GradientStop Color="#FF3F4C57" Offset="0"/><GradientStop Color="#FF273137" Offset="0.51371997594833374"/><GradientStop Color="#FF273137" Offset="1"/></LinearGradientBrush></Path.Fill></Path></Canvas></Canvas><Track x:Name="PART_Track" Margin="0,-12.64,10,-9.32" ><Track.Thumb><Thumb Style="{StaticResource ThumbStyle2}"/></Track.Thumb></Track></Grid></ControlTemplate></Setter.Value></Setter></Style>
Jeff Davis