# Properties states

# Enabled state

Any category and Property can be enabled and disabled at will. When a Property is disabled, no inplace control is shown on selection. Changing the Enabled state of a Property also changes the state of its descendants.

# > To return the Enabled state of a Property

bool enabled = propEnum.Property.Enabled;

# > To change the Enabled state

myGrid.EnableProperty(propEnum, true/false);

# Displaying an enabled/disabled checkbox

It is possible to display a checkbox to the left of the Property label, allowing the end-user to enable and disable it and all its descendants.

The ancestor's enabled state always overrides the checkbox. For example, a Property may have a checkbox set to true, but be disabled by a disabled parent.

# > To display an enabled/disabled checkbox

myGrid.SetManuallyDisabled(propEnum, true/false);

# > To get the boolean value of the enabled/disabled checkbox

bool checkboxValue = propEnum.Property.GetManuallyDisabledVariable();

# > To confirm that a Property has an enabled/disabled checkbox

bool check = propEnum.Property.CanBeDisabledManually;

Note

If the checkbox is not present, the Enabled/Disabled state of the Property is returned.

# Visible state

Any category and Property can be hidden or shown at any time. A Property with a collapsed ancestor, or positioned outside the current view of the grid will not be shown, regardless of whether Visible is true.

# > To return the visibility state of the Property

bool visible = propEnum.Property.Visible;

# > To show or hide a category or Property

myGrid.ShowProperty(propEnum, true/false);

# > To force a Property to appear inside the current view of the grid

myGrid.EnsureVisible(propEnum);

# Expanded state

A category or a Property with children can be expanded and collapsed at will.

# > To return the expanded state of a Property

bool expanded = propEnum.Property.expanded;

# > To expand or collapse a category or Property

myGrid.ExpandProperty(propEnum, true/false);

# > To expand or collapse all of the grid's categories and Properties

myGrid.ExpandAllProperties(true/false);

Another signature of the same method restricts the action to all Properties browsed by a Property enumerator. Here is how to act on all properties under the selected property:

PropertyEnumerator propEnum = SelectedPropertyEnumerator.GetDeepEnumerator();
propEnum.RestrictedToThisPropertyAndUnder = true;
ExpandAllProperties(propEnum, true);

# Read-only state

A property can be switched to read-only at runtime. On selection, it displays either a disabled or read only text box depending on the value of PropertyGrid.ReadOnlyVisual.

# > To change the read only state of a Property

propEnum.Property.Value.ReadOnly = true/false;

# Selected state

Selecting a Property displays its inplace control, if it has one.

# > To return the selected state of a Property

bool selected = propEnum.Property.Selected;

# > To select a category or Property

myGrid.SelectProperty(propEnum);

If you need to force the focus on the inplace control of a Property, use this call (the second parameter, if true, selects all the text):

myGrid.SelectAndFocusProperty(propEnum, true);

# > To ensure that no Property is selected

myGrid.SelectProperty(myGrid.RightBound);

# Deleting a Property

Deleting a Property permanently deletes it and all its descendants.

myGrid.DeleteProperty(propEnum);
Last Updated: 5/25/2022, 1:18:09 PM