Suplanus
Suplanus

Reputation: 1601

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 Application.Current.Windows ... but its only returning the WPF Windows.

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

Upvotes: 0

Views: 2421

Answers (3)

Patrick R
Patrick R

Reputation: 6857

For this you have to use

                foreach (Window win in System.Windows.Application.Current.Windows)
    {
       win..title;
    }  

Upvotes: 0

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.)

Upvotes: 2

Jay
Jay

Reputation: 274

Check this msdn Hope you find what your looking for. it also has example.

http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.applicationservices.windowsformsapplicationbase.openforms%28v=vs.110%29.aspx

Upvotes: 0

Related Questions