Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Silverlight
Slider Class
Other versions are also available for the following:
.NET Framework Class Library for Silverlight
Slider Class
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Represents a control that lets the user select from a range of values by moving a Thumb control along a track.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

Visual Basic (Declaration)
<TemplateVisualStateAttribute(Name := "Disabled", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Unfocused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "MouseOver", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Focused", GroupName := "FocusStates")> _
<TemplateVisualStateAttribute(Name := "Normal", GroupName := "CommonStates")> _
<TemplatePartAttribute(Name := "HorizontalTemplate", Type := GetType(FrameworkElement))> _
<TemplatePartAttribute(Name := "HorizontalTrackLargeChangeIncreaseRepeatButton",  _
    Type := GetType(RepeatButton))> _
<TemplatePartAttribute(Name := "HorizontalTrackLargeChangeDecreaseRepeatButton",  _
    Type := GetType(RepeatButton))> _
<TemplatePartAttribute(Name := "HorizontalThumb", Type := GetType(Thumb))> _
<TemplatePartAttribute(Name := "VerticalTemplate", Type := GetType(FrameworkElement))> _
<TemplatePartAttribute(Name := "VerticalTrackLargeChangeIncreaseRepeatButton",  _
    Type := GetType(RepeatButton))> _
<TemplatePartAttribute(Name := "VerticalTrackLargeChangeDecreaseRepeatButton",  _
    Type := GetType(RepeatButton))> _
<TemplatePartAttribute(Name := "VerticalThumb", Type := GetType(Thumb))> _
Public Class Slider _
    Inherits RangeBase
Visual Basic (Usage)
Dim instance As Slider
C#
[TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Unfocused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "MouseOver", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Focused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")]
[TemplatePartAttribute(Name = "HorizontalTemplate", Type = typeof(FrameworkElement))]
[TemplatePartAttribute(Name = "HorizontalTrackLargeChangeIncreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = "HorizontalTrackLargeChangeDecreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = "HorizontalThumb", Type = typeof(Thumb))]
[TemplatePartAttribute(Name = "VerticalTemplate", Type = typeof(FrameworkElement))]
[TemplatePartAttribute(Name = "VerticalTrackLargeChangeIncreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = "VerticalTrackLargeChangeDecreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = "VerticalThumb", Type = typeof(Thumb))]
public class Slider : RangeBase
Visual C++
[TemplateVisualStateAttribute(Name = L"Disabled", GroupName = L"CommonStates")]
[TemplateVisualStateAttribute(Name = L"Unfocused", GroupName = L"FocusStates")]
[TemplateVisualStateAttribute(Name = L"MouseOver", GroupName = L"CommonStates")]
[TemplateVisualStateAttribute(Name = L"Focused", GroupName = L"FocusStates")]
[TemplateVisualStateAttribute(Name = L"Normal", GroupName = L"CommonStates")]
[TemplatePartAttribute(Name = L"HorizontalTemplate", Type = typeof(FrameworkElement))]
[TemplatePartAttribute(Name = L"HorizontalTrackLargeChangeIncreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = L"HorizontalTrackLargeChangeDecreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = L"HorizontalThumb", Type = typeof(Thumb))]
[TemplatePartAttribute(Name = L"VerticalTemplate", Type = typeof(FrameworkElement))]
[TemplatePartAttribute(Name = L"VerticalTrackLargeChangeIncreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = L"VerticalTrackLargeChangeDecreaseRepeatButton", 
    Type = typeof(RepeatButton))]
[TemplatePartAttribute(Name = L"VerticalThumb", Type = typeof(Thumb))]
public ref class Slider : public RangeBase
JScript
public class Slider extends RangeBase
XAML Object Element Usage
<Slider .../>

A Slider control lets users select a value from a range of values.

You can customize a Slider control by setting its properties. The following list describes some of the attributes of a Slider that you can customize:

  • The orientation of the Slider, either horizontal or vertical.

  • The direction of increasing value along the Slider.

For more information about how to customize a Slider control, see the individual member.

Note:

If the value of the Slider is animated, the user may no longer be able to interact with the Slider control after the animation finishes.

For a list of the initial property values for an instance of the Slider class, see the Slider()()() constructor.

The following code example shows how to use a slider control in XAML.

XAML
<Slider Margin="0,5,0,20"
    x:Name="slider1" 
    Minimum="0" 
    Maximum="10" />

XAML
<Slider Margin="0,5,0,20"
    x:Name="slider1" 
    Minimum="0" 
    Maximum="10" />

Run this sample.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker