PowerShell Studio 2012: New Control Set Option

In the service release blog article we mentioned a new Control Set option for PowerShell Studio 2012 v3.0.4. In this article we will detail this option and how to use it.

“Use Existing Type (Match Name)” Option

When creating a control set you now have a new option that you can apply to non-visual controls such as ImageLists, ErrorProviders, etc. The “Use Existing Type (Match Name)” option functions similarly to the “Use Existing Type”. The difference is that that option will only use the existing type if the name of the non-visual control matches the name defined in the control set. Refer to the PowerShell Studio: What’s New? (Part 3) blog article for more information on control sets and the “Use Existing Type” option.

Why use this new option?

Use this option when the same non-visual control will be used by multiple instances of your control set.

For example, let’s look at the new version of the Button – Start Job. This control set consists of a button and an ImageList which contains the images used to display a busy animation when the button is pressed. It doesn’t make sense to insert multiple instances of the same ImageList, since all the button instances will use the same exact image frames to animate the button. Therefore when I created the control set, I set the ImageList’s insertion action to “Use Existing Type (Match Type)”.

Use Existing Type (Match Name)

To illustrate the difference between settings we create two versions of the control set and inserted multiple instances into our form:

Multiple Instances of the Control Set without Name Matching:

Control Set Without Name Matching

Multiple Instances of the Control Set with Name Matching:

Control Set With Name Matching


Using the “Use Existing Type” (Name Matching)” option helped create a cleaner and leaner form. Only one instance of the ImageList is used by all the Start Job buttons; whereas the “Always Insert” option inserted a copy for each button.

Furthermore, we can use the “Name Matching” option in conjunction with other controls sets. For example, if you insert the “Button – Run Process” control set, it will also use the same ImageList to animate its button.

Both Control Sets Sharing ImageList


Use Unique Names

When using the “Use Existing Type” (Name Matching)” option,  it is highly recommended to use a unique name that will not conflict with another control set. For example, never use the default name such as “imageList1”, instead use a descriptive name like “imageListButtonBusyAnimation”.


Hopefully you will be able to put the new option to good use when creating your own custom control sets.