Slider Attributes : Slider « Windows Presentation Foundation « C# / C Sharp






Slider Attributes

Slider Attributes
  

<Window x:Class="ControlDemos.Label"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ControlDemos" Height="300" Width="400">
    <Grid>
      <Slider Name="sl1" Minimum="0" Maximum="100" Value="50" IsSnapToTickEnabled="True" 
      TickPlacement="BottomRight" TickFrequency="5" IsSelectionRangeEnabled="True" 
      SelectionStart="60" SelectionEnd="90" ValueChanged="sl1_ValueChanged"/>
  </Grid>
</Window>


//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Input;
namespace ControlDemos
{

    public partial class Label : Window
    {

        public Label()
        {
            InitializeComponent();
        }
        private void sl1_ValueChanged(object sender, EventArgs e)
        {
            if (sl1.Value < sl1.SelectionStart)
                sl1.Value = sl1.SelectionStart;

            if (sl1.Value > sl1.SelectionEnd)
                sl1.Value = sl1.SelectionEnd;
        }

    }
}

   
    
  








Related examples in the same category

1.Use Slider to control the ScaleTransformUse Slider to control the ScaleTransform
2.Use Slider to control SkewTransformUse Slider to control SkewTransform
3.Use Slider to control TranslateTransformUse Slider to control TranslateTransform
4.Use Slider to control the TransformationUse Slider to control the Transformation
5.Bind Slider value to TextBlockBind Slider value to TextBlock
6.Use Slider to control the BlurUse Slider to control the Blur
7.Use Slider to control Drop ShadowUse Slider to control Drop Shadow
8.Use Slider to control the EmbossUse Slider to control the Emboss
9.Use Slider to control the GlowUse Slider to control the Glow
10.Use Slider to control the BevelUse Slider to control the Bevel
11.Vertical/Horizontal SliderVertical/Horizontal Slider
12.TickPlacement and TickFrequency for Slider
13.Binding ProgressBar with SliderBinding ProgressBar with Slider
14.Two way data binding between Slider and ProgressBarTwo way data binding between Slider and ProgressBar
15.Set Minimun/Maximum value for SliderSet Minimun/Maximum value for Slider
16.Use Slider to control Path ScalingUse Slider to control Path Scaling
17.Add a slider control and a border control to the content of the StackPanel, and add a canvas to the border control.Add a slider control and a border control to the content of the StackPanel, and add a canvas to the border control.
18.Get User Input from a SliderGet User Input from a Slider
19.slider value changed eventslider value changed event