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>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-16
  • 2021-06-15
  • 2021-09-08
  • 2022-12-23
  • 2021-10-19
  • 2021-09-11
  • 2022-12-23
相关资源
相似解决方案