views:

363

answers:

3

Can we somehow extend the RuleSetDialog class and host in our windows application?

A: 

While it's true that extending the dialog isn't exactly supported, you can get away with some customizations. On a previous project, I was able to hide and rearrange some of the dialog controls at runtime.

var dialog = new RuleSetDialog(activityType, null, ruleset);
dialog.Controls["headerTextLabel"].Visible = false;
dialog.Controls["pictureBoxHeader"].Visible = false;

...

var ruleGroupBox = dialog.Controls["ruleGroupBox"];
ruleGroupbox.Top -= 46;

... etc.

Fire up Reflector and poke around. There's nothing that stops you from hiding and moving the controls to customize it. You could even add controls to the group boxes, rewire the button handlers, or completely rearrange the form to your liking. It's a bit manual, but it can be done.

Mel
A: 

You can do that completely via a little bit of hack only : separate the intellisense textbox internal control from the System.Workflow.Activities.Rules.Design namespace ... then you can do almost anything with that. Separation means here the usual : create a wrapper (adapter precisely perhaps a Textbox control), instantiate after resolving some dependencies too (worst case you can just hide the original rule editor, parser, etc...).

Nicolai Ustinov