Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can I use WPF inside a Winforms app.?

Posted on 2010-08-13
6
Medium Priority
?
2,210 Views
Last Modified: 2013-12-17
I think I once heard that I could add a WPF form to an existing Winforms app.

True?

If so, any tricks?

Thanks,
newieweb
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 3

Accepted Solution

by:
bkokx earned 1400 total points
ID: 33435256
Hi newbieweb,

This is possible using ElementHost control and custom WPF UserControls :
There are many examples such as:

http://www.switchonthecode.com/tutorials/wpf-tutorial-using-wpf-in-winforms
http://www.codegod.de/webappcodegod/embedding-wpf-usercontrol-in-winforms-AID422.aspx

0
 
LVL 18

Assisted Solution

by:Anil Golamari
Anil Golamari earned 600 total points
ID: 33435773
0
 

Author Comment

by:newbieweb
ID: 33435866
This demo seems to have the right stuff for me to integrate a WPF User Control onto Winforms.


http://www.switchonthecode.com/tutorials/wpf-tutorial-using-wpf-in-winforms


BUT, it says I must compile the control beforfe I can add it to the form.  However I can not compile it due to the following two compile time errors:

Error      1      The type 'System.Windows.Markup.IQueryAmbient' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.      C:\Dri\Internal\PPMarket\branches\Dri\trunk\DispatchSupportWPFControl.xaml.cs      20      26      DMS


Error      2      The type name 'IComponentConnector' could not be found in the namespace 'System.Windows.Markup'. This type has been forwarded to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' Consider adding a reference to that assembly.      C:\Dri\Internal\PPMarket\branches\Dri\trunk\obj\Debug\DispatchSupportWPFControl.g.cs      42      113      DMS


Suggestions?
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:newbieweb
ID: 33435873
OK, I fixed that by ading a reference to System.Xaml.

How do I get the user control into the ElementHost?
0
 

Author Comment

by:newbieweb
ID: 33435883
Got it!

0
 

Author Closing Comment

by:newbieweb
ID: 33435886
Thanks.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question