<Grid Margin="60">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Label Content="修改上方文本框内容,下方文本框内容会跟着改变..."></Label>
<TextBox Grid.Row="1" Name="textBox1" Margin="0,0,0,20"></TextBox>
<TextBox Grid.Row="2" Name="textBox2" Margin="0,20,0,0" Text="{Binding ElementName=textBox1,Path=Text}"></TextBox>
</Grid>
示例代码
https://github.com/zLulus/NotePractice/tree/dev3/WPF/WpfDemo/Bind 下的BindDemoForView