I have a customized WPF button control and I want to use this control with a WinForm application. I know how to use WPF user controls with WinForm using ElementHost. But I have no idea to use any single control (not a user control) with all its members with a WinForm application. Can you suggest me a good way to achieve this
-
1Stick to one platform. If your app is small (say less than 100 controls total) convert the whole thing to WPF. If it's too big or you can't decide to rewrite it (say over 1000 controls) stick WinForms until you can rewrite it. It looks downright ugly to have one fancy button slapped on a standard winform and it can bring technical complications tooSten Petrov– Sten Petrov2013-03-29 16:03:30 +00:00Commented Mar 29, 2013 at 16:03
Add a comment
|
2 Answers
Use ElementHost from System.Windows.Forms.Integration namespace
Here is detailed tutorial
4 Comments
pasanmaduranga
That article describes how to add a WPF user control to Winforms. But I want to add a single control with all its members not a user control
Arsen Mkrtchyan
@pasanmaduranga, please check again... ElementHost control is for WPF in WinForms what the WindowsFormsHost was for WinForms in WPF
pasanmaduranga
What I actually want is WPF in WInForms
Arsen Mkrtchyan
Well,again ElementHost is a WinForm control that can be used to host a WPF element. ElementHost is what are you looking for, check it. I don't understand, why do you think that it is for hosting winform in wpf?