DataGrid - how to get the sort arrow in column header
-
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
-
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
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
-
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
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
-
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
No. I never used an array as a source for a DataGrid. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome