Probably I've got another unsolvable problem. In Silverlight XAML, I am unable to set by Style negative value for Slider.Minimum property. I mean, it is possible, but the results are unexpected. In WPF this does work normally.
<StackPanel Width="200" Orientation="Vertical">
<StackPanel.Resources>
<Style TargetType="Slider" x:Key="style">
<Setter Property="Minimum" Value="-10" />
<Setter Property="Maximum" Value="10" />
<Setter Property="Value" Value="0" />
</Style>
</StackPanel.Resources>
<!-- Here it is not working -->
<Slider Style="{StaticResource style}"/>
<!-- Here it works as expected, as it is not styled -->
<Slider Minimum="-10" Maximum="10" Value="0" />
</StackPanel>
The result is like this:

But obviously both thumbs should be in the same position (in the middle of Slider).
In fact, it look's like the Minimum value (-10) is accepted, but then Maximum value becomes 0, and that is why the first slider has a thumb aligned to a right side (Value is 0 and Maximum is also 0).
The problem is the HorizontalTemplate of the Slider. If you change the Orientation of the Slider to Vertical then the values defined in your style get applied as expected.
Update: The Solution is to set the Orientation also in the style. Then it works as expected.
<Style TargetType="Slider" x:Key="style">
<Setter Property="Minimum"
Value="-10" />
<Setter Property="Maximum"
Value="10" />
<Setter Property="Value"
Value="0" />
<Setter Property="Orientation"
Value="Horizontal" />
</Style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With