I am working with User Controls. I have created my own control properties. Now I want to group my own properties separately in designer grid.
How to achieve that?
Regards
I am working with User Controls. I have created my own control properties. Now I want to group my own properties separately in designer grid.
How to achieve that?
Regards
Look, here is your answer. In other words, use Category
attribute on a property.
Also, here is a link to a useful article (Custom Design-time Control Features in Visual Studio .NET). The article is rather old (2003.), but I couldn't find anything official that is more recent. Also, I don't know if you need any other specific feature, but I guess it should be a good place to start.
I've tried this and it works for me:
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
[Category("MyOwn")]
public String MyProperty { get; set; }
}
Note, however, that you can't see your properties when a designer of your user control is open. The custom properties will be visible in designer's property grid only when your user control is a part of another form/control and is selected. While designing your control, you have no designer access to such properties. Look at my picture above. The form contains a user control and then a user control is selected. Then the property is visible on the property grid.
Also, make sure the Categorized is selected in PropertyGrid:
© 2022 - 2024 — McMap. All rights reserved.