propertyGrid又一疑问: 如何设定属性组(category)的排列顺序?
我的一个类有一些实行很重要,需要用户首先注意和修改(如归纳在Initial组中),如何做到使列在首位? 问题点数:50、回复次数:4Top
1 楼jamzh(Show me the money!!!)回复于 2004-09-03 18:12:45 得分 1
不懂,帮你顶
Top
2 楼Jim3(Jim)回复于 2004-09-03 18:20:20 得分 1
好象是按照字母顺序吧
关注一下Top
3 楼jackiedlh(我思考,我存在)回复于 2004-09-06 09:16:34 得分 0
都没有讲到点子上Top
4 楼Jim3(Jim)回复于 2004-09-06 13:30:31 得分 48
搜索到的资料
链接:
http://www.dotnet247.com/247reference/msgs/34/172995.aspx
Robert Hooker
Hi all,
I'm looking for a way to sort/order the Category text items in a property
grid. The grids sort the categories by alpha when the catergories are
displayed.
Does anyone at Microsoft (or anywhere else) no of a way that we can override
that sort/order for the category text?
[ We have implemented a fair amount of code to sort/order individual items
in a property grid the way we want them, but haven't found any at all yet to
do the same for Category text...]
Rob.
Reply to this message...
Nicholas Paldino [.NET/C# MVP]
Robert,
I don't believe there is a way to do this. The only thing that I could
find that indicates you might be able to do this is the PropertySort
property. If you set it to none, it says that the properties are displayed
in the order that they are received from the type descriptor. You might be
able to create a proxy type descriptor between your object and the
propertygrid, which would then return not only the properties in the correct
order, but the properties with the categories in the order that you want
them in.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- Click here to reveal e-mail address
"Robert Hooker" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]
Reply to this message...
Robert Hooker
We've tried this - unfortunately it doesn't work. When we return the
PropertyDescriptorCollection collection, it is correctly sorted the way we
want it (categories and all), but the propertygrid simply ignores that order
for the category texts. It *does* respect the order for individual
properties within each category though...
"Nicholas Paldino [.NET/C# MVP]" <Click here to reveal e-mail address> wrote
in message news:Click here to reveal e-mail address...
[Original message clipped]
Reply to this message...
Ryan McFarren
I think I've exhausted the possibilities trying to get around this BUG. For now, we are preceding the category names with numbers to get the order we want. For example, "1 General", "2 Advanced".
--------------------------------
From: Ryan McFarren
Reply to this message...
Top




