Click here to Skip to main content
12,359,458 members (67,723 online)
Click here to Skip to main content
Articles » Languages » C# » Windows Forms » Downloads

Stats

100.1K views
4.3K downloads
87 bookmarked
Posted

Unleash PropertyGrid with Dynamic Properties and Globalization

, 29 Jan 2004 CPOL
The article presents a way to enhance the use of the PropertyGid control with dynamic properties and globalization
using System;
using System.ComponentModel;
using CustomControls.ApplicationBlocks;

namespace DynamicProperties
{
	/// <summary>
	/// Summary description for Employee.
	/// </summary>
	public class Person:DynamicTypeDescriptor, IComponent
	{

		private string _Name=string.Empty;
		private int _Age=-1;
		public event EventHandler Disposed;  //Implement IComponent.Disposed
		private ISite _curISBNSite;
	
		//Avoid using the name "Name" for your property  in  objects that implements IComoponent, because it may interfier with the  Design-Time property "Name" 
		public string FullName
		{
			get{return _Name;}
			set
			{
				if(value!=_Name)
				{
					_Name= value;
				}
			}
		}

		public int Age
		{
			get{return _Age;}
			set
			{
				if(value!=_Age)
				{
					_Age= value;
				}
			}
		}

		public virtual void Dispose() //Implement IComponent.Dispose()
		{    
			//There is nothing to clean.
			if(Disposed != null)
			{
				Disposed(this,EventArgs.Empty);
			}
		}

		[Browsable(false)]
		public virtual ISite Site //implements IComponent.Site
		{
			get
			{
				return _curISBNSite;
			}
			set
			{
				_curISBNSite = value;
			}
		}

		public Person()
		{
			//
			// TODO: Add constructor logic here
			//
		
		}
	}
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Daniel Zaharia
Web Developer
Romania Romania
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160621.1 | Last Updated 30 Jan 2004
Article Copyright 2004 by Daniel Zaharia
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid