XAML Slider Code Sample

XAML Slider element represents the slider control in XAML and WPF. The code example in this article uses <Slider> to implement a slider in WPF.

The XAML <Slider> element represents a slider control for WPF apps.
 
Slider element syntax: <Slider></Slider>
 
Similar to any other XAML element, Slider has common control properties. The Minimum and Maximum properties of Slider represent the minimum and maximum values of the slider range.
 
The following code snippet creates a Slider and sets its properties in XAML.
 
  1. <Slider x:Name="mcSlider" Width="300" Height="20"  
  2.         Background="Gray" Maximum="100" Minimum="0">              
  3. </Slider>  
The IsFocused property indicates whether the slider control has the focus and the IsDirectionReversed property represents the direction of the increasing value. By default, the slider control sits on the UI in a horizontal direction. Using the Orientation property, a slider control can be placed vertically.
  1. <Slider x:Name="mcSlider" Width="30" Height="300"  
  2. Background="Gray" Maximum="100" Minimum="0" Orientation="Vertical" >  
  3. </Slider>  
To avoid duplicate content, this article has move here : WPF Slider Control Tutorial