Updated: February 2009
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
[LocalizabilityAttribute(LocalizationCategory.Ignore)] [TemplatePartAttribute(Name = "PART_Track", Type = typeof(Track))] [TemplatePartAttribute(Name = "PART_SelectionRange", Type = typeof(FrameworkElement))] public class Slider : RangeBase
A control lets users select a value from a range of values. The following illustration shows an example of a control.
Example of a Slider Control
You can customize a control by setting its properties. The following list describes some of the attributes of a that you can customize:
The orientation of the , either horizontal or vertical.
The tick mark locations along the track.
The display of tooltips to show the current value of the .
The ability of the Thumb to either snap to tick marks or to be positioned at any point along the .
The direction of increasing value along the .
For more information about how to customize a control, see the individual member.
If the value of the is animated, the user may no longer be able to interact with the control after the animation finishes. See How to: Set a Property After Animating It with a Storyboard for options of how you can restore user control of a after it is animated.
Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Themes.
This example shows how to create a control that has tick marks.
The following example shows how to create a 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 . 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.
The following example shows how to use the Ticks property to create tick marks along the at irregular intervals.
For the complete sample, see Slider with Data Binding Sample.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.