Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. DataGrid - how to get the sort arrow in column header

DataGrid - how to get the sort arrow in column header

Scheduled Pinned Locked Moved Visual Basic
csswpfwcfalgorithmshelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T Manjaly
    wrote on last edited by
    #1

    I am writing a custom grid, inherited from datagrid. I use data-binding to populate grid from an ArrayList. When I click the column header, I am capturing the click and sorting the arraylist and re assign the data source to populate grid with sorted data. My problem is, I do not get the sort arrow in the column header. How can get this? Thanks in advance. - TOJO

    D 1 Reply Last reply
    0
    • T T Manjaly

      I am writing a custom grid, inherited from datagrid. I use data-binding to populate grid from an ArrayList. When I click the column header, I am capturing the click and sorting the arraylist and re assign the data source to populate grid with sorted data. My problem is, I do not get the sort arrow in the column header. How can get this? Thanks in advance. - TOJO

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There is no icon that is drawn for you automatically when sorting. You can't do it in a DataGrid. Although in a ListView controls Details view, you can. You have to draw it yourself using owner drawn header controls. There are a couple of articles here on CP (though searching for them is nearly impossible right now.) I've seen this done and have done it myself in ListView controls, but never a DataGrid. This will be possible to do in the next release of VS.NET 2005 and the .NET Framework 2.0. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There is no icon that is drawn for you automatically when sorting. You can't do it in a DataGrid. Although in a ListView controls Details view, you can. You have to draw it yourself using owner drawn header controls. There are a couple of articles here on CP (though searching for them is nearly impossible right now.) I've seen this done and have done it myself in ListView controls, but never a DataGrid. This will be possible to do in the next release of VS.NET 2005 and the .NET Framework 2.0. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        T Offline
        T Offline
        T Manjaly
        wrote on last edited by
        #3

        Well, if I set the allow sorting property to true and click on the header column to sort, the datagrid shows the up/down arrow by default. This works fine if my data source is a DataTable. Problem comes when I use an ArrayList as the data source. Any more thoughts on this? TOJO

        D 1 Reply Last reply
        0
        • T T Manjaly

          Well, if I set the allow sorting property to true and click on the header column to sort, the datagrid shows the up/down arrow by default. This works fine if my data source is a DataTable. Problem comes when I use an ArrayList as the data source. Any more thoughts on this? TOJO

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No. I never used an array as a source for a DataGrid. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups