WPF version of Application.OpenForms

◇◆丶佛笑我妖孽 提交于 2019-11-26 18:36:18

问题


I have an application in which I will have to get at another WPF window which is open. In WinForms, I was able to use:

MainWindow main = (MainWindow)Application.OpenForms["MainWindow"];

To be able to access the the form. Now in WPF it does not exist. I have seen the other post on this site which is relevant, however it uses Application.Window which is not contained in the call. I just have :

  • Current
  • Equals
  • GetContentStream
  • GetCookie
  • GetRemoteStream
  • GetResourceStream
  • LoadComponet
  • RefrenceEquals
  • ResourceAssembly
  • SetCookie

So my question is this, is there a different version for OpenForms, or is there just a different way to go about it.


回答1:


Try looking at: Application.Current. More specifically, Application.Current.Windows.



来源:https://stackoverflow.com/questions/2877094/wpf-version-of-application-openforms

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!