TickBar Class
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
'Declaration <LocalizabilityAttribute(LocalizationCategory.None, Readability:=Readability.Unreadable)> _ Public Class TickBar Inherits FrameworkElement 'Usage Dim instance As TickBar
/** @attribute LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) */ public class TickBar extends FrameworkElement
LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable) public class TickBar extends FrameworkElement
<TickBar .../>
The TickBar control draws tick marks that have a width of one pixel. You can define the location of the tick marks by specifying a repeating interval or a series of explicit points.
The TickBar control is specifically designed to work with a Slider control. A Slider displays tick marks. The following illustration shows a Slider that has a TickBar.
Slider with a TickBar
TickBar controls are typically defined in the Style of a Slider. For an example of a TickBar that is included in a Slider Style, see Slider Control Template.
The TickBar and Slider controls both contain properties that perform the same function. The following table shows the TickBar properties and the corresponding Slider properties to which they are bound. The TickBar properties take precedence when Slider and TickBar properties that are related are both specified.
Related TickBar and Slider Properties
| TickBar property | Slider property |
|---|---|
This example shows how to create a Slider control that has tick marks.
When you create a Slider, the default style provides a TickBar that has tick marks. The TickBar displays when you set the TickPlacement property to a value other than None, which is the default value.
The following example shows how to create a Slider with a TickBar that displays tick marks. The TickPlacement and TickFrequency properties define the location of the tick marks and the interval between them. When you move the Thumb, tooltips display the value of the Slider. The AutoToolTipPlacement property defines where the tooltips occur. The Thumb movements correspond to the location of the tick marks because IsSnapToTickEnabled is set to true.
<Slider Name="slider1" Width="100" Orientation="Horizontal" HorizontalAlignment="Left" IsSnapToTickEnabled="True" Minimum="1" Maximum="9" TickPlacement="BottomRight" TickFrequency="3" AutoToolTipPrecision="2" AutoToolTipPlacement="BottomRight" IsDirectionReversed="False" IsMoveToPointEnabled="False"/>
The following example shows how to use the Ticks property to create a tick mark collection. The example uses the collection to place tick marks at non-uniform positions along the Slider.
<Slider Width="100" Value="50" Orientation="Horizontal" HorizontalAlignment="Left" IsSnapToTickEnabled="True" Maximum="3" TickPlacement="BottomRight" AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="2" Ticks="0, 1.1, 2.5, 3"/>
For the complete sample, see Slider Sample.
System.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Primitives.TickBar
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.