PropertyGrid - attaching UITypeEditor without using Editor attribute?

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.
 
B

Bob Powell [MVP]

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.
 
Joined
Mar 30, 2015
Messages
1
Reaction score
0
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.png

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.png
    upload_2015-3-30_17-26-53.png
    45.6 KB · Views: 554
  • upload_2015-3-30_17-27-15.png
    upload_2015-3-30_17-27-15.png
    45.6 KB · Views: 406
  • upload_2015-3-30_17-40-31.png
    upload_2015-3-30_17-40-31.png
    147.5 KB · Views: 475

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top