Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
 How to: Implement a UI Type Editor

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Windows Forms Programming 
How to: Implement a UI Type Editor 

In some situations, a simple value-to-string conversion that allows a property to be displayed as text in the property browser might not be adequate. Also, a string-to-value configuration style may not be adequate for some types. For instance, in the case of a color property, a visual representation is more desirable. A UI type editor can provide a visual representation of a property value in a property grid control, such as a design-time property browser. A UI type editor can also provide a custom user interface for configuring the value or values of an object of a particular type.

NoteNote

An EditorAttribute is applied to a type or to a property to associate the type or the property with a UI type editor.

To implement a custom UI type editor for Windows Forms

  1. Define a class that derives from System.Drawing.Design.UITypeEditor.

  2. Override the EditValue method to set up properties of the user interface. This method is overloaded.

  3. Override the GetEditStyle method to inform the property browser about the editing support that you will provide.

For a complete sample, see Walkthrough: Implementing a UI Type Editor.

Compiling the Code

  • When you develop your custom UITypeEditor, it is recommended that you set the build number to increment with each build. This prevents older, cached versions of your UITypeEditor from being created in the design environment.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker