Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的主窗口上有一个 TextBlock。我想将它的文本绑定到窗口的标题.. 例如:myWindow.Title。
这一直困扰着我一整夜,我已经用谷歌搜索死了,感谢任何帮助。
谢谢。
最简单的方法就是绑定回父窗口:
<TextBlock Text="{Binding Title,RelativeSource={RelativeSource FindAncestor,AncestorType=Window}}" />