Issue with ICustomTypeDescriptor in the PropertyGrid

Hi,

I am trying to bind the PropertyGrid to a basic ICustomTypeDescriptor object, which wraps selected properties on another bigger class. I defined a CustomTypeDescriptor class but when it is assigned to SelectedObject of the PropertyGrid, the latter is not populated. All selected properties of the bigger class are marked with [Browsable(true)]

I use the following code for the GetProperties(Attribute[] attributes) overload:

...

 public BiggerObject Target=new BiggerObject();

...

public PropertyDescriptorCollection GetProperties()

{

PropertyDescriptorCollection T = TypeDescriptor.GetProperties(Target, new Attribute[1] { new BrowsableAttribute(true) });

return T;

}

and can see that T is populated with properties of the Target object. However, after that the PropertyGrid appears completely empty.

May be missing something? The same approach seems working fine with the standard WPF propertygrid. I am attaching here a minimalistic VS solution demonstrating the issue.

Thank you in advance!




Attachment: PropertyGrid_Example_807e667e.zip

1 Reply

BS Bhaskar Suresh Syncfusion Team March 26, 2024 02:54 PM UTC

Hi Ilia Korjoukov,


Sorry for the delayed response.


We have analyzed your attached sample. We have changed the SelectedObject of the PropertyGrid to the Target of the instance of the WrapperTypeDescriptor class, and now the control has been populated. Please refer to the attached sample.


When the PropertyGrid is used with ICustomTypeDescriptor, it does not support nested properties. We have already logged a feature request regarding this issue. Please refer to the following Feedback portal link.

Need to provide a ICustomTypeDescriptor support for Nested properties in the PropertyGrid | Feedback Portal (syncfusion.com)


If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal and cast your vote to make it count.


Please let us know if you need any further assistance.


Regards,

Bhaskar Suresh


Attachment: PropertyGrid_Example_eca6e53.zip

Loader.
Up arrow icon