<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.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Windows.Input
Namespace ControlDemos
Public Partial Class Label
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub sl1_ValueChanged(sender As Object, e As EventArgs)
If sl1.Value < sl1.SelectionStart Then
sl1.Value = sl1.SelectionStart
End If
If sl1.Value > sl1.SelectionEnd Then
sl1.Value = sl1.SelectionEnd
End If
End Sub
End Class
End Namespace