在自定义控件上排序自定义属性 [英] Ordering of custom properties on a custom control

查看:78
本文介绍了在自定义控件上排序自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用Vs 2008创建一个silverlight 3应用程序并混合3.我有一个自定义控件,我已经使用它创建了一些自定义属性依赖属性。可能是一个简单的问题,但有没有办法指定这些属性列出的顺序?他们似乎按字母顺序排列?


谢谢

解决方案

你好,


简短回答是否,您无法改变属性的排序顺序。


您可以为要添加到属性面板的属性创建自己的类别虽然使用如下内容:

 [可浏览(真),类别("公共属性")] 
public int MyProperty
{
get {return(int)GetValue(MyPropertyProperty); }
set {SetValue(MyPropertyProperty,value); }
}

如果需要,您可以将类别名称更改为您喜欢的名称。


希望这会有所帮助。


Hi,

I'm creating a silverlight 3 application using Vs 2008 and blend 3. i have a custom control for which i've created some custom properties by using dependency propertis. Might be a simple question but is there any way of specifying what order these properties are listed in? at the minute they seem to be listed alphabetically?

Thank you

解决方案

Howdy,

Short answer is No you cant alter the sort order of properties.

You can create your own categories for your properties to be added to the property panel though using something like the following:

[Browsable(true), Category("Common Properties")]
        public int MyProperty
        {
            get { return (int)GetValue(MyPropertyProperty); }
            set { SetValue(MyPropertyProperty, value); }
        }

You can change the category name to something you prefer if need be.

Hope this helps.


这篇关于在自定义控件上排序自定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆