是的!非常感谢!
参考您的代码,我这边在重写CellFactory的ApplyCellStyles时,先把背景色再次设置一遍就好了!
- public override void ApplyCellStyles(C1FlexGrid grid, CellType cellType, CellRange range, Border bdr)
- {
- if (cellType != CellType.Cell) return;
- // 设置只读单元格的背景色
- var col = grid.Columns[range.Column];
- if (col.IsReadOnly)
- {
- bdr.Background = _readOnlyColor; //只读背景色设置
- }
- if (grid.Selection.Row == range.Row)
- {
- var _textblock = bdr.Child as TextBlock;
- if (null == _textblock) return;
- _textblock.FontWeight = FontWeights.Bold;
- _textblock.Foreground = new SolidColorBrush(Color.FromRgb(153, 0, 0));
- }
- base.ApplyCellStyles(grid, cellType, range, bdr);
- }
复制代码 |