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.
Unfortunately, activation email could not send to your email. Please try again.

How to change the displayname of a property in a propertygrid

Thread ID:

Created:

Updated:

Platform:

Replies:

107584 Mar 7,2013 10:58 AM Mar 19,2013 08:23 AM WPF 4
loading
Tags: Tools
Mathieu Myrand Bolduc
Asked On March 7, 2013 10:58 AM

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.


Marek Jankowski
Replied On March 8, 2013 02:40 AM

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;}

Victory Jessie Selvam D [Syncfusion]
Replied On March 8, 2013 03:44 AM

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

Mathieu Myrand Bolduc
Replied On March 8, 2013 11:49 AM

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




Victory Jessie Selvam D [Syncfusion]
Replied On March 19, 2013 08:23 AM

Hi Mathieu,

Thanks for the update.

Please follow the incident I105852 for further technical support.

Thanks,
Victory

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;