We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Platform : WinForms
|
Category : Type Editors

From within a PropertyGrid, is there any way to display property names that differ from the actual class property names

You can do this but it’s not as simple as using an attribute. If you want to modify the property names for your component, you have to interact with the reflection mechanism that the grid is using by implementing ICustomTypeDescriptor. The grid operates on objects called PropertyDescriptors with are the Framework’s generic wrapper for a property, where reflection is a specific implementation. So what ICustomTypeDescriptor allows you to do is to have *your object* asked for it’s properties rather than than the default system, which is reflection.

You then write your own derived version of PropertyDescriptor (an abstract class in System.ComponentModel) and return your property descriptors instead of the ones that come back from the TypeDescriptor... so some of the impl would look something like this.

(originally from sburke_online@microsoft..nospam..com on microsoft.public.dotnet.framework.windowsforms. This code suggested by Rachid El Masoudi in an email to winformsfaq@syncfusion.com)

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon