Articles in this section
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:

  1. Create a WPF project and add a new project WPF User Control Library.

 

WPF Project

 

  1. Add the reference of WPF User Control Library assembly into the project.
  2. 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.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied