Slider Attributes : Slider « Windows Presentation Foundation « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / CSharp Tutorial » Windows Presentation Foundation » Slider 




<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;
        }

    }
}
WPF Slider Attributes














24.26.Slider
24.26.1.Normal Slider (Max=100, Val=10)Normal Slider (Max=100, Val=10)
24.26.2.A Delay of 0 and Interval of 1 make this a fast slider.A Delay of 0 and Interval of 1 make this a fast slider.
24.26.3.Vertical/Horizontal SliderVertical/Horizontal Slider
24.26.4.TickPlacement and TickFrequency for SliderTickPlacement and TickFrequency for Slider
24.26.5.Set Minimun/Maximum value for SliderSet Minimun/Maximum value for Slider
24.26.6.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.
24.26.7.Slider AttributesSlider Attributes
24.26.8.Get User Input from a SliderGet User Input from a Slider
24.26.9.Slider value changed eventSlider value changed event
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.