Category / Section
How to wrap WPF Gantt in Windows forms?
1 min read
Description:
This article describes how to wrap the WPF Gantt control in a Windows Forms application.
Solution:
- Create a WPF project and add a new project WPF User Control Library.
- Add the reference of WPF User Control Library assembly into the project.
- In the Load event of Form1 in the Windows Forms application, use ElementHost to add the WPF User Control as demonstrated in the following code sample.
void Form1_Load(object sender, System.EventArgs e) { // Create the ElementHost control for hosting the WPF UserControl. ElementHost host = new ElementHost(); host.Dock = DockStyle.Fill; // Create the WPF UserControl. UserControl1 uc = new UserControl1(); // Assign the WPF UserControl to the ElementHost control's Child property. host.Child = uc; // Add the ElementHost control to the form's collection of child controls. this.Controls.Add(host); }
Please find the required sample from this link.