User (Old forums)MemberApril 23, 2007 at 3:01 pmPost count: 23064
Is there a way to know which column was the last sorted column?
Here’s how I’m using the DataGridControl:
myDataGridControl.SelectionMode = SelectionMode.Single
myDataGridControl.ReadOnly = True
myDataGridControl.CellEditorDisplayConditions = CellEditorDisplayConditions.None
myDataGridControl.NavigationBehavior = NavigationBehavior.RowOnly
I’m trying to implement this feature: if a user clicks on a letter, the focus should be placed on the first row where the cell’s content starts with the clicked letter. In addition, since there are multiple columns per row, the cell content depends on the last sorting.
For example, let’s say I have a datagridcontrol with multiple columns, including one column for first name and one column for last name. If I sort by first name and then click on “S”, I’m taken to the row where the first name is “Sam”. But if I sort by last name and click on “S”, I’m taken to the row where the first name is “Smith”.
Imported from legacy forums. Posted by Emmanuel (had 2915 views)Xceed SupportMemberApril 24, 2007 at 2:32 pmPost count: 5658
You can determine the grouping order by looking at the DataGridControl.Items.GroupDescriptions collection.
The last entry in the collection represents the last sorted “property” (not directly “Column”). But you can then easilly relate the PropertyGroupDescription.PropertyName to a Column.FieldName from the DataGridControl.Columns collection.
Imported from legacy forums. Posted by Marcus [Xceed] (had 255 views)User (Old forums)MemberApril 24, 2007 at 3:06 pmPost count: 23064
Thanks for the tip, I knew there was some better way than just to hook up an event handler and “remember” the last column that was clicked on.
Unfortunately the GroupDescriptions collection seems to be empty regardless of whether I have sorted (clicked on a column title) or not:
myDataGridControl.Items.GroupDescriptions.Count -> is always = 0
Is there an extra step I need to do to make sure there are items in the myDataGridControl.Items.GroupDescriptions ? Remember that I’m just in “grid” mode and I set the NavigationBehavior to NavigationBehavior.RowOnly.
Imported from legacy forums. Posted by Emmanuel (had 445 views)
- You must be logged in to reply to this topic.