Dana Yeger
Dana Yeger

Reputation: 645

WPF: how to enable slider with jump of 0.1 and not complete number

This is my Slider

<Slider Name="SliderSpeed"
        Minimum="0"
        Maximum="50"
        SmallChange="0.1" 
        LargeChange="1"
        IsSnapToTickEnabled="True"
        TickPlacement="None"
        materialDesign:ThemeAssist.Theme="Dark"                          
        Value="{Binding Path=(properties:Settings.Default).Speed}"/>

So currently every time i move the slider the jump is 1 and i want the value to be able to be for example 1.5

Also properties:Settings.Default).Speeddefined as double.

Upvotes: 0

Views: 876

Answers (1)

Clemens
Clemens

Reputation: 128062

When you set IsSnapToTickEnabled="True", also set the TickFrequency property:

<Slider x:Name="SliderSpeed"
        Minimum="0"
        Maximum="50"
        LargeChange="1"
        SmallChange="0.1" 
        TickFrequency="0.1"
        IsSnapToTickEnabled="True"
        TickPlacement="None"
        materialDesign:ThemeAssist.Theme="Dark"                          
        Value="{Binding Path=(properties:Settings.Default).Speed}"/>

Upvotes: 1

Related Questions