1

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

1
  • 1
    Stick 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 too Commented Mar 29, 2013 at 16:03

2 Answers 2

4

Use ElementHost from System.Windows.Forms.Integration namespace

Here is detailed tutorial

Sign up to request clarification or add additional context in comments.

4 Comments

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
@pasanmaduranga, please check again... ElementHost control is for WPF in WinForms what the WindowsFormsHost was for WinForms in WPF
What I actually want is WPF in WInForms
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?
1

Can't you wrap it to a UserControl? You can still use Host.CustomizedButton.xxx to access all the properties and methods.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.