在我的 WPF 对象层次结构的深处,我创建了一个 Window 对象。
但是,我希望此窗口对象的所有者成为基础 Window 对象。
我尝试使用以下类型的代码“爬上树”,但这种方法似乎不是最理想的:
(((((((TabGroupPane)((ContentPane) this.Parent).Parent).Parent as
SplitPane).Parent as DocumentContentHost).Parent as
XamDockManager).Parent as ContentControl).Parent as
StackPanel).Parent...
如何访问基础 Window 对象?
我在想这样的事情:
伪代码:
Window baseWindow = this.BaseParent as Window;