1.把控件作为Binding的源
例子:拖动Slider,输入框中的值也会跟着改变,或在输入框中输入数值,滑动条也会自动移动
<Window x:Class="把控件作为Binding源.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <StackPanel> <TextBox x:Name="textBox1" Text="{Binding Path=Value,ElementName=slider1,Mode=Default,UpdateSourceTrigger=PropertyChanged}" Margin="5" BorderBrush="Black"></TextBox> <Slider x:Name="slider1" Maximum="100" Minimum="0" Margin="5"></Slider> </StackPanel> </Grid> </Window>