如何在“可见性”下声明依赖属性类别而不是“其他”?
我在一些自定义用户控件中定义了一些 DependencyProperties。我希望 Visual Studio(以及 Blend 作为奖励)在“可见性”类别下列出这些属性,而不是“其他”或“杂项”。
如何向这些属性添加一些元数据以实现这一点?
编辑:为了澄清我的问题,我想我希望显示“正常”获取/设置属性,而不是真正的静态依赖属性本身,所以作为一个例子,我想要分组的属性是连接器标签文本:
public string ConnectorLabelText
{
get { return (string)GetValue(ConnectorLabelTextProperty); }
set { SetValue(ConnectorLabelTextProperty, value); }
}
// Using a DependencyProperty as the backing store for ConnectorLabelText. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ConnectorLabelTextProperty =
DependencyProperty.Register("ConnectorLabelText", typeof(string), typeof(InputConnector), new UIPropertyMetadata("IN"));
I have a few DependencyProperties defined in some custom user controls. I'd like for Visual Studio (and Blend as a bonus) to list these properties under the "Visibility" category instead of "Other" or "Miscellaneous".
How can I add some metadata to these properties to make this happen?
Edit: To clarify my question, I guess I want the "normal" get/set properties to show up and not really the static Dependency Properties themselves, so as an example, the property I want to group is ConnectorLabelText
:
public string ConnectorLabelText
{
get { return (string)GetValue(ConnectorLabelTextProperty); }
set { SetValue(ConnectorLabelTextProperty, value); }
}
// Using a DependencyProperty as the backing store for ConnectorLabelText. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ConnectorLabelTextProperty =
DependencyProperty.Register("ConnectorLabelText", typeof(string), typeof(InputConnector), new UIPropertyMetadata("IN"));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅此问题
添加示例
See this question
Adding an example