I have a RadGridView in which one of the columns contains only buttons.
Depending on the value of a boolean variable linked to a specific record in the grid, I enable or disable the cell containing the button. This is how I achieve this:
foreach (Item item in this.radGridView.Items)
{
row = this.radGridView.ItemContainerGenerator.ContainerFromItem(item) as GridViewRow;
if (row != null)
{
cell = (from c in row.Cells
where c.Column.UniqueName == "buttonCol"
select c).FirstOrDefault();
if (cell != null)
{
if (item.buttonEnabled)
{
cell.IsEnabled = true;
}
else
{
cell.IsEnabled = false;
}
}
}
}
The problem is since my grid has horizontal and vertical scrollbars and since I am using row and column virtualization, the state of the cells containing the button that are not shown is lost. Disabling virtualization is not a solution in my case since I have a lot of data in my grid.
I wonder which event of the RadGridView would be the best to invoke my function that set the state of the button cells whenever shown values change?