寻找一种在PropertyGrid中对属性进行排序的方法 [英] Looking for a way to sort the properties in the PropertyGrid

查看:97
本文介绍了寻找一种在PropertyGrid中对属性进行排序的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

Hello All,

我看了几个不同的帖子,但仍然不确定我是否可以做我需要做的事情。在WF 3.5中,我们实现了一个自定义TypeConverter,它将查找我们在Activity属性上应用的PropertySort属性。这允许我们通过将一个整数传递给PropertySort属性的构造函数来控制属性在PropertyGrid中的排序方式
。例如,登录活动可能包含用户名和密码属性。在这种情况下,我们希望用户名显示为第一个属性,
和显示为第二个的密码。

I have looked a a few different posts but still not sure if I can do what I need to do. In WF 3.5 we implemented a custom TypeConverter that would look for a PropertySort attribute that we applied on our Activity properties. This allowed us to control how the properties were sorted in the PropertyGrid by passing in an integer to the constructor of the PropertySort attribute. For example, a Logon activity might contain a Username and Password property. In this case we want the Username to show as the first property, and the Password to show as the second.

我在WF 4.0中寻找相同类型的功能但不确定我明白如何做到这一点。如果有人能指出我的一些例子或一些文件来看待我会很感激。

I am looking for this same type of functionality in WF 4.0 but not sure I understand how to accomplish this. If anyone could point me to some examples or some documentation to look at I would appreciate it.

谢谢

推荐答案

嗨Mike,

我建议你为你的Activity提供你自己的ICustomTypeDescriptor 实现到基础实现,并在GetProperties上,在那里应用您的排序。您可能还需要提供帮助文本和其他内容!

I suggest you to provide your own ICustomTypeDescriptor implementation for your Activity, forward to the base implementation, and, on GetProperties, apply your sorting there. You may want also to provide your help text and other stuff there!

我没有为WPF设计师制作它,但在标准属性编辑器上,这种方法非常有用。 

I didn't make it for WPF designer, but on the standard property editor this approach works very well. 

查看这篇精彩文章了解更多信息:

Look at this great article for more information:

http://www.codeproject.com/KB/grid/WpfPropertyGrid.aspx

谢谢。

HTH

 


这篇关于寻找一种在PropertyGrid中对属性进行排序的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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