Email: Password:       Forgot Password 
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.

WPF Slider Control

Viewed:  2985 
Posted On:  26/11/2013 10:34:41 
How we can use slider control in WPF ? 

A Slider has a minimum and a maximum. It has a button that a user can drag back and forth.

Minimum: get or set the minimum value of the control. By default it is zero.
 Maximum: get or set the maximum value of the control. By default it is Ten.
 Value: get or set the current value of the control. By default it is zero.

XAML Code:

<Window x:Class="SliderControl.Window1"
    Title="Slider Control in WPF" Height="300" Width="300">
        <Slider HorizontalAlignment="Left"
        <TextBlock Height="21" Margin="21,82,27,0" Name="txtSliderPosition" VerticalAlignment="Top" />

Here on using slider I am showing slider current value in a TextBlock for this my cade is:

private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        var slider = sender as Slider;
        double value = slider.Value;
        txtSliderPosition.Text = "Value: " + value.ToString("0.0") + "/" + slider.Maximum;


Slider In WPF 1.png

Image 1.

When you use slider...

Slider In WPF 2.png

Image 2.

         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us