CollectionBase trouble...
-
I've downloaded some sample project and I found that contains code of how to implement adding items from design mode (CollectionBase). I've started to implement that into my test project I was working on and created a property like.
public MenuItemCollection MenuItems
{
get { return items; }
}When I go to design mode and add user control, in property grid, of that user control, I have MenuItems, but it doesn't open a dialog letting me to add the items. It acts like a string :confused:. To check whether I am crazy or not, I've added bool property to see will this work fine and display as a dropdown with true and false. That did worked, so now I am puzzled. I've searched on the net with no luck. I don't see any differences between that sample project and mine except that I use UserControl (partial class), but then again, why shouldn't properties work with partial classes as well (they worked with bool property) so now I am asking you for help. Thanks.
-
I've downloaded some sample project and I found that contains code of how to implement adding items from design mode (CollectionBase). I've started to implement that into my test project I was working on and created a property like.
public MenuItemCollection MenuItems
{
get { return items; }
}When I go to design mode and add user control, in property grid, of that user control, I have MenuItems, but it doesn't open a dialog letting me to add the items. It acts like a string :confused:. To check whether I am crazy or not, I've added bool property to see will this work fine and display as a dropdown with true and false. That did worked, so now I am puzzled. I've searched on the net with no luck. I don't see any differences between that sample project and mine except that I use UserControl (partial class), but then again, why shouldn't properties work with partial classes as well (they worked with bool property) so now I am asking you for help. Thanks.
Kasic Slobodan wrote:
public MenuItemCollection MenuItems { get { return items; } }
Looks like you are missing some attributes that has to be specified to add collection properties through property grid. I have an article which explains this. Have a look at here[^]
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Kasic Slobodan wrote:
public MenuItemCollection MenuItems { get { return items; } }
Looks like you are missing some attributes that has to be specified to add collection properties through property grid. I have an article which explains this. Have a look at here[^]
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
Your article helped. Thank you.