Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
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)
Posted 26-Feb-11 13:01pm
MRAKAR214
Edited 26-Feb-11 13:21pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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,
—SA
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.[^]
  Permalink  
Comments
SAKryukov at 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.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I thought something about this
 
<pre lang="cs">public Sometype PropertyName
{
   get
   {
      return SomeValue;
   }
   set
   {
     (new Form()).ShowDialog();
   }
}
</pre>
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 315
1 Jochen Arndt 190
2 DamithSL 125
3 PIEBALDconsult 110
4 Garth J Lancaster 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 27 Feb 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100