简体   繁体   English

如何从代码获取NavigationWindow指向的WPF页面

[英]How to get WPF Page pointed by NavigationWindow from code

I've got a WPF application wich embedded IronPython. 我有一个嵌入了IronPython的WPF应用程序。 I'm trying to access my WPF page from Python so I can modify controls defined in XAML from Python but can't manage to do it. 我正在尝试从Python访问WPF页面,以便可以从Python修改XAML中定义的控件,但无法做到这一点。 I'm using a NavigationWindow to transition from page to page, so I'd like to be able to access the current page pointed to by the NavigationWindow. 我正在使用NavigationWindow在页面之间进行转换,因此我希望能够访问NavigationWindow指向的当前页面。

I'm capable of accessing controls from a separate Window via Application.Current.MainWindow, but have had no success trying to access a page in the way described above. 我能够通过Application.Current.MainWindow从单独的窗口访问控件,但是尝试以上述方式访问页面没有成功。

Thanks! 谢谢!

Navigation window is a content control, if you want to get the page from it you can just use the .content property on the navigation window instance. 导航窗口是一个内容控件,如果要从中获取页面,可以只使用导航窗口实例上的.content属性。 Or just use the content property from the NavigationEventArgs within the onNavigated function. 或者只是使用onNavigated函数中NavigationEventArgs中的content属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM