locked
Add Category/DisplayName attributes to workflow XAML files which get preserved by the designer? RRS feed

  • Question

  • Hi,

    I want to display the custom created XAML workflows in Categories and with a DisplayName. I tried adding the Category & DisplayName attributes to the XAML file in code view. But when I load the worklow designer view and save it then category information is lost.

    For example:

     

      <x:ClassAttributes>
        <sc:CategoryAttribute xmlns:sc="clr-namespace:System.ComponentModel;assembly=System">
          <x:Arguments>
            <x:String>My Category</x:String>
          </x:Arguments>
        </sc:CategoryAttribute>
        <sc:DisplayNameAttribute xmlns:sc="clr-namespace:System.ComponentModel;assembly=System">
          <x:Arguments>
            <x:String>My Display Name</x:String>
          </x:Arguments>
        </sc:DisplayNameAttribute>
      </x:ClassAttributes>
    

    Works fine when saved from the code view, but after saving from the designer I only get:

     

     

      <x:ClassAttributes>
        <sc:CategoryAttribute />
        <sc:DisplayNameAttribute />
      </x:ClassAttributes>
    

     

     

    Is there a way to add a Category/DisplayName attributes to a workflow XAML file that gets preserved in the designer?

    Thanks
    Paul

     


    Cheers Chunda
    • Edited by Chundaman Monday, October 3, 2011 1:50 PM
    Monday, October 3, 2011 9:17 AM

Answers

  • Hi Chundaman,
    Unfortunately WF Designer XAML round tripping doesn't support Class attributes and Member attributes. At least not in VS10, I'm not sure about the next version. If your XAML is compiled into an assembly, one way you can workaround the issue for purposes of Workflow Designer is to use an IRegisterMetadata in a xxx.Design.dll assembly to add the attributes as metadata.
    Tim
    • Marked as answer by Chundaman Tuesday, October 4, 2011 8:10 AM
    Monday, October 3, 2011 6:38 PM

All replies

  • Hi,

     

    I think you can create your own custom base class with required property added.

    Use this base class as your class for designing workflows.

    like if you are strarting with a sequence activity... create your own CustomSequene activity derived from Sequence and use this as base.

    Hope this will help.

     

    Regards,


    MB
    Monday, October 3, 2011 12:31 PM
  • Hi Chundaman,
    Unfortunately WF Designer XAML round tripping doesn't support Class attributes and Member attributes. At least not in VS10, I'm not sure about the next version. If your XAML is compiled into an assembly, one way you can workaround the issue for purposes of Workflow Designer is to use an IRegisterMetadata in a xxx.Design.dll assembly to add the attributes as metadata.
    Tim
    • Marked as answer by Chundaman Tuesday, October 4, 2011 8:10 AM
    Monday, October 3, 2011 6:38 PM