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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Hooker

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

    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.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Ordering/Sorting [Category] text in a PropertyGrid

    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]
    - nicholas.paldin o@exisconsultin g.com

    "Robert Hooker" <rhooker@rhooke r.com> wrote in message
    news:eRIodM6SDH A.3132@tk2msftn gp13.phx.gbl...[color=blue]
    > 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[/color]
    override[color=blue]
    > 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[/color]
    to[color=blue]
    > do the same for Category text...]
    >
    > Rob.
    >
    >[/color]


    Comment

    • Robert Hooker

      #3
      Re: Ordering/Sorting [Category] text in a PropertyGrid

      We've tried this - unfortunately it doesn't work. When we return the
      PropertyDescrip torCollection 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]" <nicholas.paldi no@exisconsulti ng.com> wrote
      in message news:ePQKAS6SDH A.1688@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Robert,
      >
      > I don't believe there is a way to do this. The only thing that I[/color]
      could[color=blue]
      > 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[/color]
      displayed[color=blue]
      > in the order that they are received from the type descriptor. You might[/color]
      be[color=blue]
      > able to create a proxy type descriptor between your object and the
      > propertygrid, which would then return not only the properties in the[/color]
      correct[color=blue]
      > order, but the properties with the categories in the order that you want
      > them in.
      >
      > Hope this helps.
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - nicholas.paldin o@exisconsultin g.com
      >
      > "Robert Hooker" <rhooker@rhooke r.com> wrote in message
      > news:eRIodM6SDH A.3132@tk2msftn gp13.phx.gbl...[color=green]
      > > Hi all,
      > >
      > > I'm looking for a way to sort/order the Category text items in a[/color][/color]
      property[color=blue][color=green]
      > > 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[/color]
      > override[color=green]
      > > that sort/order for the category text?
      > >
      > > [ We have implemented a fair amount of code to sort/order individual[/color][/color]
      items[color=blue][color=green]
      > > in a property grid the way we want them, but haven't found any at all[/color][/color]
      yet[color=blue]
      > to[color=green]
      > > do the same for Category text...]
      > >
      > > Rob.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Scot Rose [MSFT]

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

        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 : scotr@online.mi crosoft.com <Remove word online. from address>

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




        --------------------[color=blue]
        >From: "Robert Hooker" <rhooker@rhooke r.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: <eRIodM6SDHA.31 32@tk2msftngp13 .phx.gbl>
        >Newsgroups: microsoft.publi c.dotnet.framew ork.windowsform s,microsoft.pub lic.dotnet.lang uages.csharp
        >NNTP-Posting-Host: 12.155.152.130
        >Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
        >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1695 14 microsoft.publi c.dotnet.framew ork.windowsform s:48371
        >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.
        >
        >
        >[/color]


        Comment

        • Robert Hooker

          #5
          Re: SUCCESS!! Ordering/Sorting [Category] text in a PropertyGrid

          Using "non-printable' characters works a treat.
          For everyone else struggling with category ordering\sortin g, 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" <rhooker@rhooke r.com> wrote in message
          news:eRIodM6SDH A.3132@tk2msftn gp13.phx.gbl...[color=blue]
          > 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[/color]
          override[color=blue]
          > 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[/color]
          to[color=blue]
          > do the same for Category text...]
          >
          > Rob.
          >
          >[/color]


          Comment

          Working...