Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Selecting Multiple Cells programmatically
posted

Hi,

 

I have a grid and I want to select a block of contiguous cells programmatically. I tried something like this:

 

for (int i = startIndex; i <= endIndex; i++)

{

        Cell cell = myGrid.Rows[i].Cells[0] as Cell;

        cell.IsSelected = true;                                               

 }

 

But I end up with only a single cell selected – the last one in the loop. Setting cell.IsSelected to true fires the SelectedCellsCollectionChanged event and deselects the previously selected cell. It appears that I cannot apply “Selected” to a collection of cells.

 

Is there a way to select a collection of cells programmatically?

 

Thank you.

Parents Reply Children
No Data