Base Designer with additional adornments II


Couple of customers reported an issue with applying additional adornments on the designer discussed in this post. The issue was for out of box activities which didn’t have a custom designer(were using the ActivityDesigner) itself, the adornments were not working. An example would be the Delay activity.


Currently, we don’t have a clean solution to this as the ActivityDesigner has an implicit style which is picked up by WPF. And if there is such an implicit style, the App.Resources style in our application never gets picked up.


The workaround that we have suggested is to create a simple DerivedDesigner from ActivityDesigner and then apply it on for all types that are using just the ActivityDesigner. This has to be done after loading the Workflow though rather than in the RegisterMetadata section.

AttributeTableBuilder table = new AttributeTableBuilder();
table.AddCustomAttributes(typeof(Activity), new DesignerAttribute(typeof(DerviedDesigner)));
MetadataStore.AddAttributeTable(table.CreateTable());

Hope this helps!


Thanks,


Kushal.

Comments (4)

  1. Miro says:

    Hi. could you please provide us with the source code to this?

  2. Miro says:

    Hi.

    Tried your solution out and it is not working for me.

    what I did was:

    1)took your source code from the previous article.

    2)Copy paste your 3 lines of code to RegisterMetadata method. ( I also tried more places: Just after XAML loading . after all other initializations etc.)

    3) Created the class. derived from ActivityDesigner

    and still does not work. I understand the principle you are talking about but cant make it working.

    The source code for download or some more detailed advice would help greatly.

    //Miro

  3. Akash says:

    This doesn't work unless you also add an extra style to App.xaml (copy/paste the existing style that is applied to ActivityDesigner and apply it to DerievedDesigner):

  4. Radu Crisan says:

    Hi Kushal,

    What happens if I don't derive my designer from ActivityDesigner, but instead from WorkflowViewElement? In this case I do not see the adornments.

    Radu