Here’s a workflow designer FAQ finally getting the attention it deserves, and helping show off how to do custom property editing in designer.
[Aside: Before we start the guide, note that actually doing the thing you are asking about has certain implications, and that there’s one obvious alternative that works in some cases: using a plain property, instead of an InArgument<T> typed-property.
Once you go the InArgument<T> route and restrict the UI to just a checkbox, the person using your custom activity can’t set an InArgument<bool> to custom expressions through the property grid. Which might be useful. But they can still set it to a custom expression by other ways, like editing XAML, if they can access the XAML. And they might choose to set no value at all, i.e. their InArgument<bool> == null. Take all of this into account when designing your custom activity logic.]
OK, here goes. We have a custom activity. Via the property grid it must be possible to set the EnableLions argument to one of exactly two expressions: ‘true’, or ‘false’, using a checkbox.
The first thing we should do in order to accomplish the task is associate the custom property editor to the property. We can do this in one of two ways.
Way #1) Real attribute on the property:
Way #2) registering metadata (someone will need to explicitly call this code):
Once this attribute applied, when you select the activity the workflow designer will try to instantiate an InArgumentBoolPropertyEditor object to act as the property editor. The property editor type is a new type defined thusly:
The resource loaded above is just a regular WPF DataTemplate, holding the checkbox.
Last piece of the puzzle is the converter implementation.
There is one other property editing class which you can subclass and use with workflow designer: DialogPropertyValueEditor. It works similarly, a little differently. There are samples.