WF and Type properties

Link. February 11, 2006. Comments [0]. Posted in: WinFX | Workflow

When creating a new custom activity for Windows Workflow Foundation, you might want to define a property on your activity of type System.Type. An example of a property that does this would be the InterfaceType property of the HandleExternalEventActivity.

Of course, you'd like it to be so that you could use the very nice Type selection dialog that the HandleExternalEvent Activity has, instead of just having the user type the fully qualified name of the type, which is very error prone (not to mention very user unfriendly). Fortunately, there is a way to do this, at least with beta 2 of WF, by using the TypeBrowserEditor class defined in System.Workflow.ComponentModel.Design as the UITypeEditor for your Type property. Here's an example:

/// <summary>

/// Type of the message object to expect

/// </summary>

[DefaultValue(typeof(string))]

[Description("Type of the message object to expect")]

[Category("Activity")]

[Editor(typeof(System.Workflow.ComponentModel.Design.TypeBrowserEditor),

   typeof(System.Drawing.Design.UITypeEditor))]

[ValidationOption(ValidationOption.Required)]

public Type MessageType

{

   get { return _messageType; }

   set { _messageType = value; }

}

 



Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Categories

Statistics

Total Posts: 1050
This Year: 1
This Month: 1
This Week: 0
Comments: 825

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.2.8279.16125

Sign In