Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need to connect a WPF project with a C# project.

I have one project done in visual C# ("ClassRoom") and another project done in WPF ("ActivityRoom"). In Visual 3 project I've got a form called MainForm and in WPF project I have a window called MainWindow.

I need to open the MainWindow by clicking a button in MainForm.

How can I do this?
Posted
Comments
VallarasuS 2-Jul-11 13:01pm    
WPF and WinForm controls are interoperable, there exists ElementHost to make the WPF controls work with windows form, however i wonder if there exists a way to achieve this.
Mark Salsbery 2-Jul-11 13:48pm    
You haven't specified what type of projects they are....executables I assume? Or libraries? If executables then one process would need to start the other process.
Sergey Alexandrovich Kryukov 2-Jul-11 20:43pm    
Watch you language! WPF project can also be C# project, so it makes your question confusing. You should call them Windows Form and WPF projects.
--SA
Thilina C 14-Jul-11 12:21pm    
It doesn't matter the language I use as long as you understand it.
And I've found the solution for this.

Take a look at the following link, explains how to achieve this.

Open a WPF Window from WinForms [^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 2-Jul-11 20:44pm    
Some solution, a 5. However, the whole idea is bad.
--SA
Vivek Krishnamurthy 3-Jul-11 0:39am    
Agree, These solution should be considered as temporary and in unavoidable cases only.
Found a solution,
You can just open the window the same way as from the WPF application directly

You have to add references to the WPF assemblies to your WinForms project but It'll only open the window. It won't execute any thing in the App.xaml


WPFproject.mainWindow main=new WPFproject.mainWindow();
main.show();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900