I hide specific properties with this code:
propertyItem.Visibility = Visibility.Collapsed;
Is it possible to hide a full category? Now my workaround is this:
if (propertyItem.Category == "MyCategory")
{
propertyItem.Visibility = Visibility.Collapsed;
}
If i hide all items of a category, the header of it, is always visible. Is there a way to hide the header of a category?
Your target is not so easy to achieve, but at the same time is not impossible to reach. First of all we need to create our style for making hidden a category without visible properties:
As you can see, it uses a simple converter:
and some other resources (I copied them from the standard ones by using ILSpy):
Now we need to extend the
PropertyGrid
control for setting our style in thePropertyItemsControl
contained by thePropertyGrid
:So your XAML will be
I hope it can help you.