0
왜이 바인딩이 업데이트되지 않습니까?간단한 XAML 바인딩의 실수
코드 : MainWindow.xaml
<Window x:Class="WpfApplication12.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication12"
Height="350" Width="525">
<StackPanel>
<local:UserControl1 x:Name="usr" />
<TextBlock Text="{Binding ElementName=usr, Path=txt.Text}" />
</StackPanel>
</Window>
UserControl1.xaml
인해 보호 수준에<UserControl x:Class="WpfApplication12.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBox Text="qwe" x:Name="txt" />
</UserControl>
그래, 그거야. 내부로 표시된 이유를 이해할 수 없어야합니다. – Poma
그런 다음 텍스트 상자가 아닌 strng 속성을 표시합니다. –
@Poma : 바인딩에서 모든 것은 공용 속성이어야하며 필드는 작동하지 않습니다. –