Home > Net >  Ask: what about the PropertyGrid control use, add custom properties.
Ask: what about the PropertyGrid control use, add custom properties.

Time:11-06

Add a custom attributes for the system control, and retain control original properties,

In WinForm custom controls, select a system such as pictureBox, binding propertyGrid will display the corresponding attributes,
I want to add an attribute, such as in the propertyGrid add a "author" custom attributes,

According to my understanding, now should be to create a new class based on PictureBox class, add the "author" in the new class attribute, I don't want to influence the system controls the original attributes,
Just want to add a property, so this method should be very troublesome, is there any other simple way

The original control of the system, not custom controls.

thank you

CodePudding user response:

River's lake slang "tray set of controls"

Is Microsoft on the edge of the block, not on the UI, placed in the bottom "stripes", such as DataBindingSource ErrorProdvider is this category, they will achieve
IExtenderProvider interface

So we who is baidu once IExtenderProvider can get information
https://www.cnblogs.com/ahdung/p/4169724.html

Ps: WPF's reliance on property, the solution is the same thing

CodePudding user response:

reference 1st floor wanghui0380 response:
runescape slang "tray set of controls"

Is Microsoft on the edge of the block, not on the UI, placed in the bottom "stripes", such as DataBindingSource ErrorProdvider is this category, they will achieve
IExtenderProvider interface

So we who is baidu once IExtenderProvider can get information
https://www.cnblogs.com/ahdung/p/4169724.html

Ps: WPF's reliance on property, the solution is the same thing


Thank you, this item is not the custom properties, there is no way to customize and development,

CodePudding user response:

I probably know what you mean, you want the pg embedded in their own software

So it is better to do, is still that the above method, and then put a dynamic proxy classes outside, emit dynamic extension attributes,

Dynamic proxy object=var dynamic proxy generator
. AddThe Create ()

Such a dynamic proxy objects, the middle add equivalent to the new rules, after all, sometimes we just want to for some particular type dynamic add specific attributes, so I need to specify the rules (here I'll or move the IExtenderProvide rules, and the characteristics of the above definition)

CodePudding user response:

In fact I think Microsoft is exactly the same way, he may be traversal of the biggest Container and Site (find inside have IExtenderProvide instance)

So, we can do a experiment, according to the above inherited his first, and then add in your own root container that instance, and then looking at the results,

To be off work, I won't experiment, such as free, give it a try

CodePudding user response:

The to wanghui0380, thank you,
Actual demand is to develop a prototype design, the development of similar design interface, using the propertyGrid adjust control,
I have no contact with this knowledge, based on some FormDesigner DesignSurface and code to the main function,
The pictureBox image source is local, now hope to obtain in the database, I would like to add a property, to browse and select the database in the record, to achieve the function is similar to the image attributes
About propertyGrid, most of the information is either based on custom class or attribute of an object, either a standard controls, filtering and screening of the attributes of the original, no standard controls attribute increases,
I think propertyGrid shows all control class attribute, now do not know should consider is made development in the control class, or on the propertyGrid development, first, thank you.

CodePudding user response:

See the IExtenderProvider information in the afternoon, haven't see, is looking at, hope to have time to give directions,
  •  Tags:  
  • C#
  • Related