@ -11,7 +11,7 @@
<TextBox x:Name="tbxByXaml" VerticalAlignment="Center"/>
<Label x:Name="lblByXaml" Height="30" VerticalAlignment="Center" Content="{Binding ElementName=tbxByXaml, Path=Text}"/>
<Label HorizontalAlignment="Center">--- By Code Behind ---</Label>
<TextBlock x:Name="tbxByCodeBehind"/>
<TextBox x:Name="tbxByCodeBehind"/>
<Label x:Name="lblByCodeBehind" Height="30" VerticalAlignment="Center"/>
</StackPanel>
</Window>
@ -30,7 +30,7 @@ namespace DataBindingSample
{
Binding binding = new Binding();
binding.Source = tbxByCodeBehind;
binding.Path = new PropertyPath(tbxByCodeBehind.Text);
binding.Path = new PropertyPath(TextBox.TextProperty);
lblByCodeBehind.SetBinding(Label.ContentProperty, binding);
}