在设计器网格中单独分组我的自定义控件属性
我正在使用用户控件。我创建了自己的控件属性。 现在我想在设计器网格中单独分组我自己的属性。
如何实现这一目标?
问候
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看,这是您的答案。换句话说,在属性上使用
Category
属性。另外,这里还有一个有用文章的链接(Visual 中的自定义设计时控制功能.NET 工作室)。这篇文章相当旧(2003 年),但我找不到任何更新的官方文章。另外,我不知道您是否需要任何其他特定功能,但我想这应该是一个很好的起点。
我已经尝试过了,它对我有用:
但请注意,当您的用户控件的设计器已打开。仅当您的用户控件是另一个表单/控件的一部分并被选中时,自定义属性才会在设计器的属性网格中可见。在设计控件时,设计者无权访问此类属性。看我上面的照片。该窗体包含一个用户控件,然后选择一个用户控件。然后该属性在属性网格上可见。
另外,请确保在 PropertyGrid 中选择“分类”:
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:
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: