【发布时间】:2010-04-19 21:06:08
【问题描述】:
我有一个 RadGridView,其中一列只包含按钮。
根据链接到网格中特定记录的布尔变量的值,我启用或禁用包含按钮的单元格。这就是我实现这一目标的方式:
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;
}
}
}
}
问题是因为我的网格有水平和垂直滚动条,而且由于我使用的是行和列虚拟化,所以包含未显示按钮的单元格的状态会丢失。就我而言,禁用虚拟化不是解决方案,因为我的网格中有很多数据。
我想知道 RadGridView 的哪个事件最适合调用我的函数,该函数在显示值发生变化时设置按钮单元格的状态?
【问题讨论】:
标签: c# silverlight telerik