ReadOnly state on a category

Grids for WPF Forum

Posted 14 years ago by shlomi R
Version: 9.2.0510
Hi, is there any way to set all the properties inside a specific category to read only mode based on another property value?

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA

That is certainly possible. The built-in property editors (as well as the Editors for WPF interop property editors) check the attached and inheirted PropertyGrid.IsReadOnly property. So what you can do is create an implicit Style for PropertyGridDataAccessorItem (which displays all items in the PropertyGrid), that binds the attached property to some value. The example below shows how to bind the attached property for a specific category, but you could modify to just use a Trigger so it's applied to all categories.
<propgrid:PropertyGrid ...>
        <Style TargetType="{x:Type propgrid:PropertyGridDataAccessorItem}">
                    <Condition Property="DataAccessorType" Value="Category" />
                    <Condition Property="DisplayName" Value="MyCategoryName" />
                <Setter Property="propgrid:PropertyGrid.IsReadOnly" Value="{Binding ...}" />
Once you set the attached property, the editors inside the category should be read-only.

Actipro Software Support

Posted 14 years ago by shlomi R
Thanks, it was very helpful.
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.