Designtime experience in Workflow designer Control Sample

Hello

I have used the sample in my own application, and I am very happy with it. However, I don't understand how the designtime experience comes into play - In the visual studio designer, there are little red blobs that appear when the validations fail. When I put in my own validations on my custom controls there is no designtime experience like this.

Is there anything one can do? It would add the icing on the cake. It would also be useful to have the propertygrid select the offending property, like is the case in VS.

Best Regards

Peter Villadsen

[562 byte] By [PeterVilladsen] at [2007-12-17]
# 1
Hi Peter,

Are you noticing this when you don't set a property that you have deemed as "required" in your validations? If so, I can explain the problem.

In one of my posts on another thread, I desribed the two types of properties an activity can have:

Angel Azcarraga wrote:

Activity properties have two flavors: meta (or "shared") and instance. A meta property is immutable at runtime and must be set to a literal value at design time. An instance property, as the name suggests, can be optionally set at design time, they can be bound to instance data (the actual value is not determined until runtime), and can be modified directly during workflow execution.


By default, all activity properties are instance properties, which means that even you mark them as "Required" through the ValidationVisibility attribute, they will not be validated at design time because it is valid to set them at runtime too, so validation would be unreasonably strict if we flagged this. Now, if the property is a meta property (you can set this by setting "Shared" to "true" in the Custom Properties dialog in the VS custom activity designer), then if it is not set at design time, it will be flagged and the "red balloon" will appear as you expect it to.

You can verify that your validation is being run by setting one of your properties to an invalid value (if this is possible in your case, or just temporarily make it possible as a test) and you should see the designer behavior you're expecting.

If this doesn't answer your question, please send me more details on your scenario and I'd be happy to help.

Thanks!
Angel

AngelAzcarraga at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

I have found the settings for turning on and off the configuration errors.

WorkflowTheme.CurrentTheme.ReadOnly = false;

WorkflowTheme.CurrentTheme.AmbientTheme.ShowConfigErrors = false;

WorkflowTheme.CurrentTheme.ReadOnly = true;

Howver, when I have the errors turned on, the red balloon will show but there is nothing in the drop down to tell me what is wrong?

Example,

I add a code activitiy in VS and get a red ballon along with a message stating "Property ExecuteCode is not set" in the drop down.

If I add a code activity to my designer host, I get a red ballon but no message?

NateGarvey at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3
hi,

i faced the same problem recently. obviously, the designer application (or the control) lacks some functionality.
as your last post is from 01-25-2006, do you have a solution by now?

thx,
manu

manuelfoerster at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4

The validation errors are displayed as a context menu. So in order to display them, you need to show a context menu from the MenuCommandService. In ShowContextMenu, look for a menuID of WorkflowMenuCommands.DesignerActionsMenu. This will tell you to build the validation errros menu item.

Here is how I build the command list for the menu. I am not sure if this 100% correct but it works.

private void GetDesignerActionsMenu(ContextMenu contextMenu)

{

Dictionary<CommandID, string> commands = new Dictionary<CommandID, string>();

ICollection commandList = this.GetCommandList(WorkflowMenuCommands.DesignerActionsMenu.Guid);

foreach (object command in commandList)

{

if (!(command is DesignerVerb))

continue;

commands.Add(((DesignerVerb)command).CommandID, ((DesignerVerb)command).Text);

}

List<MenuItem> menuItems = this.GetMenuItemsFromCommands(commands);

foreach (MenuItem menuItem in menuItems)

contextMenu.MenuItems.Add(menuItem);

}

NateGarvey at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
thank you, this is a good point to start from.
manuelfoerster at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified