It is possible to use Syncfusion WPF controls in Windows Forms Application by following below steps.
Step 1: Create Windows Forms and Windows Forms Control Library Application
Need to create Windows Forms application as shown in below screenshot.
Figure 1: Windows Forms Application
Need to create the Windows Control Library application as like in below.
Figure 2: Windows Forms Control Library Application
Step 2: Configure the required WPF assemblies
Need to add UserControl.Xaml file in Windows Forms Control Library Application and required Syncfusion WPF dependency assemblies.
Here we are using the Syncfusion SfAccordion WPF control. So it is needed to add UserControl.xaml file into the project.
Figure 3: Adding UserControl.Xaml file into the WindowsControlLibrary application.
Then it is needed to add the necessary configuration for SfAccordion WPF control in the loaded UserControl.Xaml file.
The following code snippets explain the same.
Step 3: Need to create Element Host class.
To load WPF control in Windows Forms application, it is needed to implement Class derived from ElementHost and load SfAccordion WPF control in it.
The following code snippet explains the same.
Step 4: Need to attach Windows Control Library project into Windows Forms application.
It is needed to attach the created Windows Control Library project into Windows Forms application and add it to its assembly reference section.
Step 5: Need to add SfAccordion control in Windows Forms application.
As both the applications are merged, it is needed to rebuild the whole application. It will add SfAccordion WPF control in Windows Forms Application Designer Page Toolbox. It can be dragged and dropped into the Form Designer.
Figure 11: Loading WPF SfAccordion control into Windows Forms application.
And now it can be used in Windows Forms application.
Figure 12: SfAccordion control can be used in Windows Forms Application.
To run the Application and open the Form Designer, it is needed to rebuild this application.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|