How to hide other variables based on a value found in the PropertyGrid?

Hello,


How to change the visibility of another variable in the PropertyGrid based on the value of the variables in a class that we have bound to the PropertyGrid? For example, let's assume that there are variables Type, Description, and Size in the class. When the value of the Type variable is String, the Description variable is visible on the PropertyGrid, and the Size variable is hidden. If the value of the Type variable is double, the Size variable is visible and the Description variable is hidden.


It can be hidden by saying [Browsable(false)] in Normal. But how can we do this dynamically?


8 Replies 1 reply marked as answer

RS Raghavendra Sudhakar Syncfusion Team May 30, 2023 01:06 PM UTC

Hi Ozgur,


We are validating your reported query. We will validate and update you on or before 01st June 2023. We appreciate your patience until then.


Regards,

Raghavendra S



RS Raghavendra Sudhakar Syncfusion Team June 1, 2023 03:09 PM UTC

Hi Ozgur,


We have created a sample based on your requirements. Please refer the sample for your reference. Please revert us if this is not the case.


Regards,

Raghavendra S


Attachment: PropertyGridSample_a6bb4332.zip

Marked as answer

ÖZ Özgür replied to Raghavendra Sudhakar June 2, 2023 07:06 AM UTC

Thank you for the answer.



ÖZ Özgür June 7, 2023 08:42 AM UTC

Hi, when the PropertyGrid is Refreshed, if there are open subclasses, it closes after the refresh. I have to press the expand button again and open it. How can I avoid shutdown?



BA BagavathiPerumal Apranandham Syncfusion Team June 8, 2023 03:05 PM UTC

Hi Ozgur,



We are validating your reported query. We will validate and update you on or before 12th June 2023. We appreciate your patience until then.




Regards,
Bagavathi Perumal A



BA BagavathiPerumal Apranandham Syncfusion Team June 12, 2023 12:49 PM UTC

Hi Ozgur,



We recommend utilizing the IsExpanded property of the PropertyViewItem to achieve your requirement. We have created a sample based on your requirement. Please refer to the attached sample for your reference.




Regards,
Bagavathi Perumal A


Attachment: PropertyGridWPF_c3568f3a.zip


ÖZ Özgür June 12, 2023 01:51 PM UTC

Thank you very much for your reply. It was a quick solution. May I ask an additional question?

Is there a way to make IsExpanded = True specifically for the name I want, but not all of the PropertyViewItem? For example, I want IsExpanded true if the name is Address, and false if Desc.



BA BagavathiPerumal Apranandham Syncfusion Team June 13, 2023 02:03 PM UTC

Hi Ozgur,



We have created a sample based on your requirements. Please refer to the sample for your reference. Please revert us if this is not the case.



Regards,

Bagavathi Perumal A


Attachment: PropertyGridSample_WPF_143289d3.zip

Loader.
Up arrow icon