Files
docs-desktop/dotnet-desktop-guide/framework/wpf/controls/how-to-customize-the-ticks-on-a-slider.md
T
David CoulterandAndy De George 674b773578 Links: .NET Desktop - framework\wpf (#109)
* Links: .NET Desktop - framework\wpf

* Apply suggestions from code review

Co-authored-by: Andy De George <[email protected]>
2020-11-05 13:50:29 -08:00

2.0 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Customize the Ticks on a Slider 03/30/2017
TickBar [WPF]
Slider control [WPF], creating with TickBar
4fa694f2-a620-4b15-be78-5f4286f89361

How to: Customize the Ticks on a Slider

This example shows how to create a xref:System.Windows.Controls.Slider control that has tick marks.

Example

The xref:System.Windows.Controls.Primitives.TickBar displays when you set the xref:System.Windows.Controls.Slider.TickPlacement%2A property to a value other than xref:System.Windows.Controls.Primitives.TickPlacement.None, which is the default value.

The following example shows how to create a xref:System.Windows.Controls.Slider with a xref:System.Windows.Controls.Primitives.TickBar that displays tick marks. The xref:System.Windows.Controls.Slider.TickPlacement%2A and xref:System.Windows.Controls.Slider.TickFrequency%2A properties define the location of the tick marks and the interval between them. When you move the xref:System.Windows.Controls.Primitives.Thumb, tooltips display the value of the xref:System.Windows.Controls.Slider. The xref:System.Windows.Controls.Slider.AutoToolTipPlacement%2A property defines where the tooltips occur. The xref:System.Windows.Controls.Primitives.Thumb movements correspond to the location of the tick marks because xref:System.Windows.Controls.Slider.IsSnapToTickEnabled%2A is set to true.

The following example shows how to use the xref:System.Windows.Controls.Slider.Ticks%2A property to create tick marks along the xref:System.Windows.Controls.Slider at irregular intervals.

[!code-xamlSlider#4]

See also