How to change names and images for the Activities?  
Author Message
NMM





PostPosted: Windows Workflow Foundation, How to change names and images for the Activities? Top

Hi,

I want to re-host the designer surface with the activities toolbox in a host form as shown in the sample. My question is:

Is it available to change the name and the image of an activity in the toolbox while preserving its functionality

For example, I want to change the "While loop" name to "Loop Sub-Process" to coop with the BPMN standard..

Can I do it And how

Thanks,

Nada



Software Development for Windows Vista17  
 
 
Matt Milner - Pluralsight





PostPosted: Windows Workflow Foundation, How to change names and images for the Activities? Top

Yes, you can use themes to accomplish this.

In visual Studio, go to Tools | Options and then find the Workflow Designer options. You'll be able to create a new theme there which will be in a file on the file system. In the rehosted designer, you can then choose the theme you want with this code:

WorkflowTheme.CurrentTheme = WorkflowTheme.Load(filePath);

Be aware that image paths in the theme file will be relative to the theme, so you may need to edit them to get it working. The theme file is just an XML file.

Matt



 
 
NMM





PostPosted: Windows Workflow Foundation, How to change names and images for the Activities? Top

Thanks Matt, but I didn't get the idea " Be aware that image paths in the theme file will be relative to the theme, so you may need to edit them to get it working ".

What do you mean here What should I do to get it work probably..

I have also another question .. Can I alter the properties of the activities by editing, adding, hiding some of the field, as we do with the custom properties

Thank you again..

Nada

 
 
Matt Milner - Pluralsight





PostPosted: Windows Workflow Foundation, How to change names and images for the Activities? Top

On the first item: the IDE will probably warn you, but if you specify a new image for an activity, the path that it puts in the *.wtm file (the theme file) is relative to the theme file itself. So, if you move the file, you need to move the images or update the path as well.

On the second item, I don't belive you can hide an existing property on a control you didn't write, but you can add them. Use an attached dependency property to accomplish this. Essentially, when you register the property, you use the RegisterAttached method, and then you can set this value on other activities. I have an example activity on the community site [1] that adds a condition property to child activities using this method. It will be helpful to review, especially if you want design time support for setting the property as that takes a bit more work, but it is straight forward.

Matt

[1] http://wf.netfx3.com/files/folders/control_flow/entry3469.aspx



 
 
NMM





PostPosted: Windows Workflow Foundation, How to change names and images for the Activities? Top

Thanks Matt...

I'll review the example ...

Thank you again...

Nada