Create a Two-Way Binding
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WPF" Height="100" Width="260">
<StackPanel>
<Slider Name="slider"
Margin="4" Interval="1"
TickFrequency="1"
IsSnapToTickEnabled="True"
Minimum="0" Maximum="100"/>
<StackPanel Orientation="Horizontal" >
<TextBlock Width="Auto" HorizontalAlignment="Left"
VerticalAlignment="Center" Margin="4"
Text="Gets and sets the value of the slider:" />
<TextBox Width="40" HorizontalAlignment="Center" Margin="4"
Text="{Binding
ElementName=slider,
Path=Value,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</StackPanel>
</Window>
Related examples in the same category