Click here to Skip to main content
15,892,746 members
Articles / Programming Languages / C#

Globalized Property Grid - Revisited

Rate me:
Please Sign up or sign in to vote.
4.73/5 (36 votes)
14 Jun 20036 min read 174.3K   2.4K   75  
Localization of category names in a globalized property grid control and considers inheritance issues
This article is an incremental version of its base article Globalized property grid. It discusses the localization of category names and localized property names in case of inheritance.
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace GlobalizedPropertyGrid
{

	/// <summary>
	/// Person is the test class defining two properties: first name and last name .
	/// By deriving from GlobalizedObject the displaying of property names are language aware.
	/// GlobalizedObject implements the interface ICustomTypeDescriptor. 
	/// </summary>
	public class Person : GlobalizedObject
	{
		private string firstName = "";
		private string lastName = "";
		private int age = 0;

		public Person() {}

		[GlobalizedCategory("Required")]
		public string FirstName
		{
			get { return firstName; }
			set { firstName = value; }
		}

		// Uncomment the next line to see the attribute in action: 
		[GlobalizedCategory("Required")]
//		[GlobalizedProperty("Surname",Description="ADescription",Table="GlobalizedPropertyGrid.SpecialStringTable")]
		public string LastName
		{
			get { return lastName; }
			set { lastName = value; }
		}

		[GlobalizedCategory("Optional")]
		public int Age
		{
			get { return age; }
			set { age = value; }
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Web Developer
Germany Germany
For ten years I worked as a senior consultant, coach, lead architect and project lead for several consulting companies.
Currently I work as a system architect for Zuehlke Engineering GmbH based in Frankfurt.
You can find a detailed resume here.

Comments and Discussions