[SOLVED] PropertyGrid change attribute value dynamically

Answered
0
0

Hello everyone! I am trying to dynamically change the value of the Browsable attribute for a property. It works fine when initializing the PropertyGrid, but nothing happens after refreshing.

  • You must to post comments
Best Answer
0
0

The System.ComponentModel library in .NET doesn’t let you change a property attribute. You’d have to implement the ICustomTypeDescriptor interface to return the kind of PropertyDescriptor you need.

But… Since the System.ComponentModel system can get quite complicated, the PropertyGrid in Wisej provides additional events and overloadable methods that allow for a certain degree of customization without having to deal with the TypeDescriptors. You can derive from PropertyGrid and overload GetProperties(), it lets you filter the properties to display.

  • You must to post comments
0
0

There are 2 properties in the DataItem class. If the first value is false, the second is hidden. If true, then the second property becomes visible.

  • You must to post comments
0
0

Thanks for your reply! I’ll try to make changes according to your recommendations. But the same code works fine in a WinForms application.

  • Luca (ITG)
    Wrong sample? There is no browsable attribute usage nor popertygrid.
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.