Click here to Skip to main content
15,882,412 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i'm making my own user control and have 2 questions
1. i want to add a button on default properties list and i want to open a modal form when that button is clicked,
2. i want to group my control properties in one category (the attribute Category(...) doesn't work, as i found it works only with property grid added by me)
Updated 26-Feb-11 12:21pm

This is quite possible but not easy at all; you'll to write several things to allow custom edit in the PropertyGrid. I think modal form is not a good idea as you can do much better by providing a custom in-place editor. However, a modal form is also possible: you in-line editor will be the button you want; and this button will show your modal form.

I tried to describe a road map on this topic here: How to get response when click PropertyGrid[^].

Again, this is not easy, so I'm sorry I cannot afford developing code specially for your case. It would be far beyond the format of CodeProject Questions-and-Answers. You can get the idea, go to help pages on the types I list in my Answer and write your own code, ask another question if and when you face any problems.

See also: Setting value in textbox when it is taken from combobox..[^].

Good luck,
Share this answer
To achieve your aims you will probably have to write a UITypeEditor[^] and one or more ControlDesigners or one of its descendants and quite possibly one or more TypeConverters. From your description possibly an ExpandableObjectConverter[^].

Here is a link to an example that uses most of these.[^]
Share this answer
Sergey Alexandrovich Kryukov 27-Feb-11 12:38pm    
Henry, just to note: this is more complex then you're trying to explain here. Pointing to UITypeEditor points in right direction, only one step in many. Basic idea is that you never need to change property grid, you need to create special data class to be shown in the grid to wrap around "real" data; such "fake" data should be designed the way to use one or another UITypeEditor; as to ExpandableObjectConverter, I'm pretty much sure, there is not need in it in this situation.
I thought something about this

<pre lang="cs">public Sometype PropertyName
      return SomeValue;
     (new Form()).ShowDialog();
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900