Category / Section
How to host Maps.WPF to WinForms?
1 min read
You can host the WPF Map control into WinForms by following the given steps:
- Create a new project and select the WPF User Control Library template under the Windows Desktop category.
- Initialize the maps control and define the required features either in the UserControl1.xaml or UserControl1.cs file available in the created WPF user control library.
- Create a new Windows Forms Application template under the Windows Desktop category.
- In the Solution explorer of windows forms application, right-click and add the WPF User Control Library as existing project.
- Add this library project as reference to the Windows Forms Application by clicking Add Reference in RefernceManager of WinForms application.
- Initialize and add the UserControl1 defined in the WPF user control library in the Form1.cs file.Note:
Add the following references in WPF User Control Library.
- WindowsBase
- PresentationCore
- PresentationFramework
- System
Add the following references in Windows Forms Application.
- PresentationCore
- PresentationFramework
- System.Xaml
- WindowsBase
- WindowsFormsIntegration
Sample for host the WPF maps control into WinForms: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WFHost-1254467776