Click here to Skip to main content
13,796,389 members
Click here to Skip to main content
Articles » Languages » C# » Windows Forms » Downloads

Stats

206.5K views
6.5K downloads
147 bookmarked
Posted 7 Jan 2016
Licenced CPOL

PropertyGrid utilities

, 7 Jan 2016
An article on sorting and globalization of properties in a PropertyGrid.
bin
FormsUtilsTest
FormsUtilsTest.exe
FormsUtils.dll
nl
FormsUtilsTest.resources.dll
FormsUtils
FormsUtils.dll
nl
FormsUtils.resources.dll
src
FormsUtils
FormsUtils.cmbx
FormsUtils.prjx
FormsUtilsKey.snk
FormsUtilsTest
FormsUtilsTest.cmbx
FormsUtilsTest.prjx
SomeOtherResources.resources
FormsUtils.dll
FormsUtilsTest.exe
nl
FormsUtils.resources.dll
FormsUtilsTest.resources.dll
FormsUtilsTest
FormsUtilsTest.SomeClassWithProperties.nl.resources
FormsUtilsTest.cmbx
FormsUtilsTest.prjx
MainForm.resources
MyNameSpace.MainForm.resources
MyNameSpace.PropertyGridUtilTest.resources
MyNameSpace.SomeClassWithProperties.resources
PropertyGridUtilTest.resources
SomeClassWithProperties.resources
SomeOtherResources.resources
FormsUtils
CustomPropertyGrid.nl.resources
CustomPropertyGrid.resources
FormsUtils.CustomPropertyGrid.resources
FormsUtilsKey.snk
PropertyGridUtils
bin
nl
PropertyGridUtils.resources.dll
PropertyGridUtils.dll
PropertyGridUtils.cmbx
PropertyGridUtils.CustomPropertyGrid.nl.resources
PropertyGridUtils.CustomPropertyGrid.resources
PropertyGridUtils.prjx
PropertyGridUtilsKey.snk
PropertyGridUtilsTest
bin
nl
PropertyGridUtils.resources.dll
PropertyGridUtilsTest.resources.dll
PropertyGridUtils.dll
PropertyGridUtilsTest.exe
MyNameSpace.MainForm.resources
MyNameSpace.PropertyGridUtilTest.resources
MyNameSpace.SomeClassWithProperties.nl.resources
MyNameSpace.SomeClassWithProperties.resources
PropertyGridUtilsTest.cmbx
PropertyGridUtilsTest.prjx
SomeOtherResources.resources
/*
 * Created by SharpDevelop.
 * User: wout
 * Date: 9-10-2004
 * Time: 17:58
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Reflection;

namespace FormsUtils
{
	/// <summary>
	/// Delegate that allows a class to change property attributes that
	/// define a property's behaviour in 
	/// a <see cref="System.Windows.Forms.PropertyGrid"/>.
	/// </summary>
	public delegate void PropertyAttributesProvider(PropertyAttributes propertyAttributes);
	
	/// <summary>
	/// Use this attribute on a property to set a property's
	/// <see cref="PropertyAttributesProvider"/> delegate.
	/// </summary>
    [AttributeUsage(AttributeTargets.Property)]
	public class PropertyAttributesProviderAttribute : Attribute
	{
		string propertyAttributesProviderName;

		/// <summary>
		/// Constructor.
		/// </summary>
		public PropertyAttributesProviderAttribute(string propertyAttributesProviderName)
		{
			this.propertyAttributesProviderName = propertyAttributesProviderName;
		}
		
		/// <summary>
		/// Get the <see cref="PropertyAttributesProvider"/> specified by the
		/// <see cref="PropertyAttributesProviderAttribute"/> on given target object.
		/// </summary>
		public MethodInfo GetPropertyAttributesProvider(object target) {
			return target.GetType().GetMethod(propertyAttributesProviderName);
		}

		public string Name
		{
			get { return propertyAttributesProviderName; }
		}
	}
}

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

wout de zeeuw
Software Developer (Senior)
Netherlands Netherlands
Wout works as a freelancer based in the Netherlands. His interests are .NET, 3D, DWG, DXF, OpenGL, Computational Geometry and playing Tank Ball!

One of his latest private projects is a commercial DWG DXF .NET library and small DWG DXF viewing application.

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.181207.3 | Last Updated 7 Jan 2016
Article Copyright 2016 by wout de zeeuw
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid