Tim*_*Tim 4 devexpress xtragrid
我的xtraGrid有一个自定义样式eventlistener:
FooGridView.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(FooGridView_RowCellStyle);
private void FooGridView_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
DevExpress.XtraGrid.Views.Grid.GridView vw = (sender as DevExpress.XtraGrid.Views.Grid.GridView);
try
{
DataRow DR = vw.GetDataRow(vw.GetRowHandle(e.RowHandle));
if (**some condition based on one or more values in the DataRow**)
{
e.Appearance.Font = new System.Drawing.Font(e.Appearance.Font, System.Drawing.FontStyle.Strikeout);
e.Appearance.ForeColor = Color.LightGray;
}
else
{
e.Appearance.Font = new System.Drawing.Font(e.Appearance.Font, System.Drawing.FontStyle.Regular);
e.Appearance.ForeColor = Color.Black;
}
}
catch (Exception ex) { }
}
Run Code Online (Sandbox Code Playgroud)
单击网格列标题以占用网格后,格式最终会在排序重新排序行之后应用于错误的行.如何解决这个问题?
你正在把这个e.RowHandle给你并转换成一个DataSourceHandle.然后,你打电话GetDataRow给DataSourceHandle.
但是,GetDataRow接受行句柄,而不是数据源句柄.试试这个:
DataRow DR = vw.GetDataRow(e.RowHandle);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7553 次 |
| 最近记录: |