Suplanus Suplanus - 4 months ago 51
C# Question

Get opened Forms-Windows in WPF-Application

I want to get all opened windows (WPF) and forms (WF) of my Mixed-application.
There is a method called

... but its only returning the WPF Windows.

Note: The Windows Forms are stored in an other project (DLL) in the solution.


You can access Windows Forms' open forms via the System.Windows.Forms.Application.OpenForms static property. The property is contained in the System.Windows.Forms.dll assembly, so you will need a reference to it.

(IIRC, this property only returns the forms that were created on the current thread; therefore, if you have two separate UI threads (one for Windows Forms, one for WPF), I believe you need to call the property on Windows Forms' UI thread.)