wpf 的 Window或UserControl绑定自己后台属性
public string Name{get;set;}
1.
<Window> {Binding Name, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}} </Window>
2.
<Window x:Name="Wd">
<TextBlock Text="{Binding Name, ElementName=Wd}"/>
</Window>
3.
<Window DataContext="{Binding RelativeSource={RelativeSource Self}}"> <TextBlock Text="{Binding Name}"/> </Window>