Removing the Tool container from the Workflowview

 I've just recently been asked to make a 'minor' change to a customized version of the WorkflowView which forms part of the System.Workflow.ComponentModel.Design namespace.

The image below highlights the ToolContainer:

 

By investigating the WorkflowView object using reflector I discovered that there was an internal field called ShowToolContainter that is hard-coded to true. See below:

 

By using  reflection you can set this property to false!! Thus removing those irritating buttons.


Type t = _workflowView.GetType();

//// Set the parent field.

t.InvokeMember("ShowToolContainer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty, null, _workflowView, new Object[] { false });

Where there is a will there is a way!! You can use this technique in future to set other internal properties which the framework does not expose.

Jean

 

 

Published 11 September 2008 02:37 by jean
Filed under:

Comments

No Comments