I want to change the thickness of ticks and the shape of a tick (arrow shaped etc...) beneath a slider in WPF. I have looked everywhere. What i found was only how to change the height and the color of ticks.
-
can you please provide the tick shape which you want? – Vishvadeep singh Jan 03 '19 at 13:20
-
arrow shaped would be excellent ? – Nemanja Vidačković Jan 03 '19 at 13:28
-
removed useless tag – Jolta Jan 03 '19 at 13:39
-
Use blend to get the template of the slider, then amend it accordingly. – XAMlMAX Jan 03 '19 at 15:37
-
The Telerik controls allow you to provide custom styles for all the parts of a slider. If you’re using those then look on the Telerik help pages. – Coops Jan 03 '19 at 15:39
1 Answers
Not a great solution but you can make a custom template and then add a UniformGrid with the desired items.
To add a custom template, add a slider to your xaml. Assuming you are using visual studio, you can go to the Properties Window and under the Miscellaneous section you can go to Templates -> Convert to New Resource.
From here you will be able to make changes to the default template.
Just under the TickBars, I added a UniformGrid. You can remove the TickBars but I left them to show as a comparison in the picture below.
<UniformGrid Columns="11">
<TextBlock Text="▼" TextAlignment="Left"/>
<TextBlock Text="▼" TextAlignment="Left" Margin="7,0,0,0"/>
<TextBlock Text="▼" TextAlignment="Left" Margin="13,0,0,0"/>
<TextBlock Text="▼" TextAlignment="Left" Margin="20,0,0,0"/>
<TextBlock Text="▼" TextAlignment="Left" Margin="24,0,0,0"/>
<TextBlock Text="▼" TextAlignment="Center"/>
<TextBlock Text="▼" TextAlignment="Right" Margin="0,0,24,0"/>
<TextBlock Text="▼" TextAlignment="Right" Margin="0,0,20,0"/>
<TextBlock Text="▼" TextAlignment="Right" Margin="0,0,13,0"/>
<TextBlock Text="▼" TextAlignment="Right" Margin="0,0,7,0"/>
<TextBlock Text="▼" TextAlignment="Right"/>
</UniformGrid>
The text is for a down arrow. You can find other arrows here.
The first, middle, and last textblock will align with where the ticks would normally be. The rest will need offsets, which is what the margins are for. They will be equal on each side, but note that this isn't very reasonable to hard code these unless you know the control will not change size. If the control changes size, you will have to do some math to generate both the font and the margins dynamically.
I changed my foreground and background colors for better visibility but you should end up with something like this.

- 588
- 6
- 21