locked
VS 2010 Workflow Designer Extensibility RRS feed

  • Question

  • Hello

    VS 2010 has nice feature that allows to extend it's WPF Designer. 

    What about extending VS 2010 Workflow Designer ?

    I tried to use the same technique with no success.

    I need to preview the Activity Designer being dropped to Workflow Designer and register appropriate design-time service with 

    Context.Services

    Can anyone please help ?

    Thanks


    Wednesday, May 25, 2011 7:45 AM

All replies

  • Hello

    VS 2010 has nice feature that allows to extend it's WPF Designer. 

    What about extending VS 2010 Workflow Designer ?

    I tried to use the same technique with no success.

    Can anyone please help ?

    Thanks

    • Merged by Jie Bao Wednesday, May 25, 2011 7:34 PM duplicate
    Wednesday, May 25, 2011 7:35 AM
  • Hi Alex,
    Which way would you use to do this in WPF designer?

    Suggestions I would normally make for WF designer extensibility are using IActivityTemplateFactory, or using a static constructor for your designer, or doing something during IRegisterMetadata.

    But I just realized probably most of my suggestions are no good because you don't have the EditingContext during them.
    Possibly the next best thing you can do is override OnModelItemChanged on your activity designer, and register services there, would that be early enough?

    Tim

    • Edited by Tim Lovell-Smith Wednesday, May 25, 2011 4:57 PM oops, EditingContext
    Wednesday, May 25, 2011 4:54 PM
  • Have a look at  FeatureAttribute for WPF designer extensibility.

    In my case I can't use IActivityTemplateFactory, the request is to be able to edit xaml in VS, the xaml has been created in rehosted designer.

    Yes , the lack of access to EditingContext is exactly the problem .

    I know I can publish my service in OnModelItemChanged , but this is "ugly design", I want to decouple hosting environment from ActivityDesigner. 

    Thanks for your input anyway.


    Wednesday, May 25, 2011 6:32 PM
  • Thank you for the extra information.
    Tim
    Wednesday, May 25, 2011 6:56 PM
  • Hello

    VS 2010 has nice feature that allows to extend it's WPF Designer. 

    What about extending VS 2010 Workflow Designer ?

    I tried to use the same technique with no success.

    I need to preview the Activity Designer being dropped to Workflow Designer and register appropriate design-time service with 

    Context.Services

    Can anyone please help ?

    Thanks



    Hi Alexander,

    Could you please explain a little bit what kind of preview you want to have? It would be great if you can give a concrete example of the scenario you want to achieve so that we can try to see how to help.

     

    Thanks.

    Thursday, May 26, 2011 2:53 AM
  • My activity has designer that relies on my custom service, in re-hosted designer I publish the service when workflow designer gets created :

     

    workflowDesigner.Context.Services.Publish<IMyService> ( myService );
    

     

    Activity designer uses it this way :

     

     protected override void OnInitialized ( EventArgs e ) {
       base.OnInitialized ( e );
       DependencyPropertyDescriptor.FromProperty ( WorkflowViewElement.ContextProperty , typeof ( WorkflowViewElement ) ).AddValueChanged ( this , ( sender , args ) => {
        IMyService srv= Context.Services.GetService<IMyService> ();
     // use srv to populate combo box
       } );
    

     

    After end user finishes workflow configuration in re-hosted  designer he  saves it as xaml file.

    The request is to be able to edit this xaml in VS project.

    To support this, I need  to get EditingContext of VS hosted workflow designer  to create and register IMyService.

    I know I can get EditingContext  in IActivityFactory callback ( if i provide factory for my activity for VS) through the DependecyObject being passed by casting it to WorkflowElement, but this doesn't help me.

    IRegisterMetadata  also lacks access to EditingContext.

    Please ask if it isn't clear enough.

    Thanks

     


     


    Thursday, May 26, 2011 8:58 AM