Can I use WPF inside a Winforms app.?

Posted on 2010-08-13
Last Modified: 2013-12-17
I think I once heard that I could add a WPF form to an existing Winforms app.


If so, any tricks?

Question by:newbieweb
  • 4

Accepted Solution

bkokx earned 350 total points
ID: 33435256
Hi newbieweb,

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

LVL 18

Assisted Solution

by:Anil Golamari
Anil Golamari earned 150 total points
ID: 33435773

Author Comment

ID: 33435866
This demo seems to have the right stuff for me to integrate a WPF User Control onto 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=, 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=, 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.


Author Comment

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

How do I get the user control into the ElementHost?

Author Comment

ID: 33435883
Got it!


Author Closing Comment

ID: 33435886

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# Offline Apllication 5 70
How to join on ID, with prefix? 15 58
VB.Net Tranfer data between to VB.Net apps 8 25
No Data for DropDown List 2 24
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.…

776 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