Auto hide empty category

Grids for WPF Forum

Posted 3 months ago by BenjaminLopVic - France
Version: 23.1.4
Avatar

Hello,

I followed the "Dynamic Properties" sample from the WPF Controls Sample Browser to help me hide some properties, and it works well.

However, if I hide all properties of a category, the category is still visible. How can I automatically hide it? Additionally, is it possible to hide an entire category instead of hiding each property individually?

Any insights or suggestions would be greatly appreciated.

Thank you in advance!

Benjamin.

Comments (2)

Answer - Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Benjamin,

In that sample, we added an IsVisible property to the CustomPropertyModel class that inherits our PropertyDescriptorPropertyModel class.  You would probably need to do the same kind of thing by making a CustomCategoryModel and have it inherit our CategoryModel.  You could override the factory.CreateCategoryModel method to create your instance instead.  In the MainControl.xaml, you'd have to set the CategoryStyle property to a similar Style as the one for PropertyStyle. 

Perhaps when your CustomPropertyModel's IsVisible value changes, you could look at its Parent and if it's a CustomCategoryModel, call its InvalidateIsVisible method too.  Then the CustomCategoryModel.IsVisible property would need to look at its contained properties and see if any were visible for it to be true.

That is probably the general approach we'd take to get categories hiding as well.


Actipro Software Support

Posted 3 months ago by BenjaminLopVic - France
Avatar

Hello,

Thank you very much, this solution is perfect.

Benjamin.

[Modified 3 months ago]

The latest build of this product (v24.1.2) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.