PropertyGrid - attaching UITypeEditor without using Editor attribute?

  • Thread starter Thread starter Dr. Proctor
  • Start date Start date
D

Dr. Proctor

Hello

I have a PropertyGrid in my app that displays set of properties that
is created dynamically at run-time. Ie. I use a collection that
implements ICustomTypeDescriptor and it's instance is bound to
PropertyGrid's SelectedObject.

This collection stores PropertyDescriptor-derived objects, which are
the actual properties being edited. I would like to add custom
UITypeEditor for properties with certain custom datatypes. But I can't
use Editor attribute, because the properties are created dynamically.

Is there a switch case somewhere deep in the WinForms library that
binds certain datatypes, like System.Drawing.Color, to a specific
UITypeEditor? What I'd like to do is to override and extend this
functionality with my own types.

Thanks in advance.
 
OTTOMH you may be able to use the ICustomTypeDescriptor interface to create
attributes for the dynamic properties such as the editorattribute...

This isn't something I've tried though as the generation of dynamic
attributes seems a bit esoteric.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Hello
How to edit Custom Control propertygrid.
For example :
[Category("Appearance")]
[DisplayName(@"BorderThickness")]
public Thickness ControlBorderThickness
{

get
{

return _borderThickness;
}
set { _borderThickness = value;OnPropertyChanged("ControlBorderThickness"); }
}
i want to use propertygrid.doubleupdown control instead of default editor
upload_2015-3-30_17-40-55.webp

in above image......Border thickness has default editor thickness..but i want to use doubleupdown instead of 2,2,,2
 

Attachments

  • upload_2015-3-30_17-26-53.webp
    upload_2015-3-30_17-26-53.webp
    10.1 KB · Views: 566
  • upload_2015-3-30_17-27-15.webp
    upload_2015-3-30_17-27-15.webp
    10.1 KB · Views: 414
  • upload_2015-3-30_17-40-31.webp
    upload_2015-3-30_17-40-31.webp
    69.8 KB · Views: 483
Back
Top