|
private void Button_Click(object sender, RoutedEventArgs e)
{
List<int> rowIndex = new List<int>();
List<GridCellInfo> listOfCells = new List<GridCellInfo>();
var cells = this.sfGrid.GetSelectedCells();
//Get the row index based on the selected cells and sorted it
foreach(var item in cells)
{
var rindex = this.sfGrid.ResolveToRowIndex((item as GridCellInfo).RowData);
rowIndex.Add(rindex);
}
rowIndex.Sort();
//Get the Selected cells based on the sorted row index
for (int j=0;j<rowIndex.Count;j++)
{
foreach (var item in cells)
{
var rindex = this.sfGrid.ResolveToRowIndex((item as GridCellInfo).RowData);
if (rindex == rowIndex[j])
listOfCells.Add(item);
}
}
} |