By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,671 Members | 1,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,671 IT Pros & Developers. It's quick & easy.

Q: Ordering/Sorting [Category] text in a PropertyGrid

P: n/a
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.
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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]
- ni**************@exisconsulting.com

"Robert Hooker" <rh*****@rhooker.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl...
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.

Nov 13 '05 #2

P: n/a
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]" <ni**************@exisconsulting.com> wrote
in message news:eP**************@TK2MSFTNGP11.phx.gbl...
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]
- ni**************@exisconsulting.com

"Robert Hooker" <rh*****@rhooker.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl...
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.


Nov 13 '05 #3

P: n/a
There is no Documented or supported way to do it and nothing is exposed to allow it... I suppose its possible to 'hack' something but I haven't seen anything to indicate anyone
has.

Want to know more? Check out the MSDN Library at http://msdn.microsoft.com or the Microsoft Knowledge Base at http://support.microsoft.com

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : sc***@online.microsoft.com <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.


--------------------
From: "Robert Hooker" <rh*****@rhooker.com>
Subject: Q: Ordering/Sorting [Category] text in a PropertyGrid
Date: Wed, 16 Jul 2003 08:04:04 -0600
Lines: 15
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <eR**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.windowsforms,mic rosoft.public.dotnet.languages.csharp
NNTP-Posting-Host: 12.155.152.130
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:169514 microsoft.public.dotnet.framework.windowsforms:483 71
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

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.

Nov 13 '05 #4

P: n/a
Using "non-printable' characters works a treat.
For everyone else struggling with category ordering\sorting, to achieve
this:

+Z First Category
+ some props
+T Second Category
+ other props
+ A third category
+ more props

You can do this:
[Category("\t\tZ First Category]
[Category("\tT First Category]
[Category("A third Category]

It seems the PropetyGrid includes the "tabs" for the purposes of sorting,
but excludes them when it actually renders the text in the cell.

Rob.
"Robert Hooker" <rh*****@rhooker.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl...
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.

Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.