Slider.Ticks Property

Gets or sets the positions of the tick marks to display for a Slider.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
public DoubleCollection Ticks { get; set; }
/** @property */
public DoubleCollection get_Ticks ()

/** @property */
public void set_Ticks (DoubleCollection value)

public function get Ticks () : DoubleCollection

public function set Ticks (value : DoubleCollection)

<object>
  <object.Ticks>
    <DoubleCollection .../>
  </object.Ticks>
</object>
<object Ticks="DoubleCollection" .../>

Property Value

A set of tick marks to display for a Slider. The default value is a null reference (Nothing in Visual Basic).

Identifier field

TicksProperty

Metadata properties set to true

None

Tick marks that are outside the range that is defined by the Minimum and Maximum property values are ignored.

The TickPlacement property must be set to a value other than None for tick marks to appear.

The following example shows how to set the Ticks property. For the complete sample, see Slider Sample.

 <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"/>

Slider hslider = new Slider();
hslider.Orientation = Orientation.Horizontal;
hslider.Width = 100;
hslider.IsMoveToPointEnabled = false;
DoubleCollection tickMarks = new DoubleCollection();
tickMarks.Add(1.1);
tickMarks.Add(1.3);
tickMarks.Add(2.0);
tickMarks.Add(7.0);
tickMarks.Add(10.0);
hslider.Ticks = tickMarks;
hslider.TickPlacement = TickPlacement.BottomRight;
hslider.AutoToolTipPlacement =
  AutoToolTipPlacement.TopLeft;
hslider.AutoToolTipPrecision = 2;
hslider.IsSnapToTickEnabled = true;
cv2.Children.Add(hslider);

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.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show: