Search code examples
wpfworkflow-foundation-4

How can I Host the WorkflowDesigner of WorkflowFoundation 4 in a Winforms application?


I don't have much explanation that the tittle himself, lol.

But, what I really want to do is load de WorkflowDesigner on an Winform ElementHost Control.

I try doing this: Host WorkflowDesigner in a WPF Application, but it doesn't work.

Thanks!


Solution

  • Solved!

    private void Form1_Load(object sender, EventArgs e)
    {
        new DesignerMetadata().Register(); //Missing Line
    
        des = new WorkflowDesigner();
        des.Load(mFileName);
        elementHost1.Child = des.View;
    }
    

    Only was needed to add the missing line "new DesignerMetadata().Register();"

    Note: elementHost1 is a WinForm ElementHost Control, direct from the toolbox! ;)