Home Forums WinForms controls Xceed Grid for WinForms Basic Sorting Question Reply To: Basic Sorting Question

User (Old forums)
Member
Post count: 23064

Never mind, I found the problem. One of the developers here created a class that inherits from Xceed.Grid.GridControl and put a nice little method on it called AllowSorting(bool). I assumed the code had been tested, but looking at what he’d written, that is obviously not the case. The code is posted below, so you can feel a bit of my insanity when I saw what was written.

public void AllowSorting(bool value)
{
_allowSorting = value;
int numHead = 0;
foreach (Xceed.Grid.Row cmRow in FixedHeaderRows)
{
ColumnManagerRow cmr = cmRow as ColumnManagerRow;
if (cmr != null)
{
numHead++;
}
}

if (numHead == 0)
{
if (_managerRow == null)
{
_managerRow = new ColumnManagerRow();
}
}

for (int i=0; i < this.FixedHeaderRows.Count; i++)
{
Xceed.Grid.ColumnManagerRow row = this.FixedHeaderRows[i] as Xceed.Grid.ColumnManagerRow;
if (row != null)
{
row.AllowSort = false;
}
}
}

Imported from legacy forums. Posted by jbeerhalter (had 4073 views)