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. Image for the cookie policy date

How to change the displayname of a property in a propertygrid

Good day,

We are using a propertygrid and need to change the DisplayName et Description that appear in the property grid, as we must support several languages.  How would we go about doing that?

Thank you for your time.


4 Replies

MJ Marek Jankowski March 8, 2013 07:40 AM UTC

Hi,
did you try this code?

using System.ComponentModel;

[Category("Test")]
[DisplayName("Test Property")]
[Description("This is the description that shows up")]
public string TestProperty {get;set;}


VJ Victory Jessie Selvam D Syncfusion Team March 8, 2013 08:44 AM UTC

Hi Mathieu,

Thanks for using Syncfusion products.

You can achieve your requirement by creating custom class with properties setting DisplayName attribute, Description attribute and bind the instance of custom class with SelectedObject property of PropertyGrid.

Download the attached sample.

Please let us know in case of queries.

Regards,
Victory Jessie



Forum_107584_56cf78be.zip


MM Mathieu Myrand Bolduc March 8, 2013 04:49 PM UTC

Than you both for the quick answer,

The problem with the "[DisplayName("Test Property")]" solution is that is is set a compile time and not at run time.  I need to change the Display Name if the user changes language, during the execution (i.e. "First Name" would change to "Prenom" if the user changes language from English to French)

I tried changing the instance attribute "DisplayName" during the execution, but it did not properly change the value of the display name in the control, (See following link for details on what I tried http://stackoverflow.com/questions/51269/change-attributes-parameter-at-runtime).

I saw no examples of localization with the propertygrid and I was wondering about how to do it.

Thank you for your time





VJ Victory Jessie Selvam D Syncfusion Team March 19, 2013 12:23 PM UTC

Hi Mathieu,

Thanks for the update.

Please follow the incident I105852 for further technical support.

Thanks,
Victory

Loader.
Up arrow icon