Although I am not really using WinForms a lot, I know that there are situations when a WPF control needs to be somehow plugged in to a WinForms project, especially when you want to bring a custom UI design to an existing app. And although it seems to be a quite interesting task to do, in fact it is quite simple. To get started, I created a WPF User Control Library project in Visual Studio that will be used as the control sample.
I am going to use it to create a simple reusable control that can be plugged in both WPF and WinForms projects. Once the solution is created, you will see the familiar WPF designer: NOTE: You can add additional properties and events inside the control. If those have the proper access modifiers set, you will be able to later on access them from your WinForms app.Now you can build the project and get the output DLL. Once you have the library compiled, switch to your WinForms application. In a WinForms project, there is the ElementHost control available in the ToolboxRead more: DZone
I am going to use it to create a simple reusable control that can be plugged in both WPF and WinForms projects. Once the solution is created, you will see the familiar WPF designer: NOTE: You can add additional properties and events inside the control. If those have the proper access modifiers set, you will be able to later on access them from your WinForms app.Now you can build the project and get the output DLL. Once you have the library compiled, switch to your WinForms application. In a WinForms project, there is the ElementHost control available in the ToolboxRead more: DZone
0 comments:
Post a Comment