Property Pane: Change property values of multiple objects
- Written by June Blender
- Last Updated: 14 June 2016
- Created: 20 May 2016
- Hits: 4589
Sometimes, I say things so many times that I start to believe them, even when I’m wrong. Here’s a correction of one of the details that I’ve gotten wrong repeatedly.
“You can only use the Properties pane on one object at time.” — me
The Properties pane in PowerShell Studio displays the properties and property values of an object, that is, one of the Windows Forms controls on the Designer pane. By default, it displays the properties of one object at a time.
To determine which object the Properties pane displays:
- In the Designer pane, click the object.
- In the Properties pane, use the menu at the top of the pane.
However, when you select multiple objects in the Designer pane, such as by using Shift+Click or Ctrl+Click, PowerShell Studio shows its smarts.
First, it indicates that more than one object is selected by not displaying the name of an object in the Properties pane menu. That’s your clue that it’s displaying properties of multiple objects.
Then, it displays only the properties that the selected objects have in common. When all selected objects have a property, that property is displayed; otherwise, it is omitted.
For example, when I select a Textbox and a Button, I see only the subset of common properties.
When all selected objects have the same value for a shared property, that property value is displayed; otherwise, the value is blank.
For example, in this image, I’ve selected two Textbox object. Because they both have an Anchor property, the Anchor property appears in the display. But, because they have different values for the Anchor property, no property value appears.
You can also change the property values of multiple objects at one time. For example, this GUI app has six Textbox objects. I can select all of them and then change their properties.
For example, I can change the value of the ReadOnly property to True and the value of the Anchor property to Top, Left, Right. The change affects all selected objects.
That’s not just efficient. It also helps me to keep the property values of similar objects uniform.
And, now I know that the Properties pane displays the properties of one object at a time, except when it doesn’t, and that’s when it really shines!