Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF MVVM WinForm
I have 2 projects - 1 is a Winforms application and the second is a WPF form (both C# .NET4). I would like to call the WPF form from my winforms application by creating an object of the WPF application class(passing a few values to the constructor as well) and using the .show() method.
 
I need an example of how to do this as I am new to MVVM pattern and I am not sure how to do this.
 
name of view = MainWindow.xaml
name of view model viewModel = MyViewModel.cs (the data context of my view is set to my view model)
the model is common to both the winforms and WPF application.
I am not sure what object to create to display the WPF form.
 
If you can give me any link to a sample application it will be a big plus point.
Posted 25-Mar-13 3:16am
Edited 25-Mar-13 3:17am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I recently come across sample of creating systry application as systry application and not winform application that minimize to the try. long story short it include the using of winform and wpf in the same program.
this is the article:
https://www.simple-talk.com/dotnet/.net-framework/creating-tray-applications-in-.net-a-practical-guide/[^]
and the exact section:
https://www.simple-talk.com/dotnet/.net-framework/creating-tray-applications-in-.net-a-practical-guide/#fifteenth[^]
 
He wrote there that he took this from here:
http://weblogs.asp.net/jdanforth/archive/2008/07/29/open-a-wpf-window-from-winforms.aspx[^]
 
also from there you can go to mixing wpf and winform
https://www.simple-talk.com/dotnet/.net-framework/mixing-wpf-and-winforms/[^]
 
I hope this will help you.
  Permalink  
Comments
rohith naik at 25-Mar-13 10:46am
   
Thanks Yair-I, i didnt know about the EnableModelessKeyboardInterop(). Thanks for all the links too.
Maciej Los at 25-Mar-13 11:06am
   
+5!

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

  Print Answers RSS
0 OriginalGriff 480
1 Maciej Los 290
2 Richard MacCutchan 225
3 BillWoodruff 185
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,764
1 Sergey Alexandrovich Kryukov 7,437
2 DamithSL 5,639
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411028.1 | Last Updated 25 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100