Hi,
I use a PropertyGrid with nested categories (as the objects we show via the grid often have hierarchical references to other objects).
As this structures can be sometimes confusing for the user, I would like to use different colors for the category background depending on the level of depth.
I found some sample code in the forum which changes the background color of items with "Property" as DataAccessorType and tried to use this code for categories:Unfortunately, this does not change the background of category items (but the same code works for Background of property items and the Foreground color of category items, so I suppose changing the background color of a category item like this is not possible?).
Is there a way I can change the background color of a category item without defining a complete new style for PropertyGridDataAccessorItem? And can I also change the indent of items in the same way?
Any help would be appreciated.
Thanks,
Patric
I use a PropertyGrid with nested categories (as the objects we show via the grid often have hierarchical references to other objects).
As this structures can be sometimes confusing for the user, I would like to use different colors for the category background depending on the level of depth.
I found some sample code in the forum which changes the background color of items with "Property" as DataAccessorType and tried to use this code for categories:
<Style TargetType="{x:Type propgrid:PropertyGridDataAccessorItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding DataAccessorType,
RelativeSource={RelativeSource Self}}"
Value="Category">
<Setter Property="Background" Value="Pink"/>
</DataTrigger>
</Style.Triggers>
</Style>
Is there a way I can change the background color of a category item without defining a complete new style for PropertyGridDataAccessorItem? And can I also change the indent of items in the same way?
Any help would be appreciated.
Thanks,
Patric