回复 1楼shayne的帖子
方法一:cellstyles
- var cs1 = new C1.Silverlight.FlexGrid.CellStyle();
- cs1.FontWeight = FontWeights.Bold;
- cs1.FontStyle = FontStyles.Italic;
-
- var cs2 = new C1.Silverlight.FlexGrid.CellStyle();
- cs2.FontWeight = FontWeights.Thin;
- cs2.FontStyle = FontStyles.Italic;
-
- for (int _row = 0; _row < c1FlexGrid1.Rows.Count; _row++)
- {
- c1FlexGrid1.Rows[_row].CellStyle = _row % 2 == 0 ? cs1 : cs2;
- }
复制代码
方法二:Cellfactory
- public class MyCellFactory : C1.Silverlight.FlexGrid.CellFactory
- {
- public override void ApplyCellStyles(C1.Silverlight.FlexGrid.C1FlexGrid grid, C1.Silverlight.FlexGrid.CellType cellType, C1.Silverlight.FlexGrid.CellRange rng, Border bdr)
- {
- base.ApplyCellStyles(grid, cellType, rng, bdr);
-
- if (cellType == C1.Silverlight.FlexGrid.CellType.Cell)
- {
- var row = grid.Rows[rng.Row].Index;
- if (row % 2 == 0)
- {
- grid.Rows[row].FontWeight = FontWeights.Bold;
- grid.Rows[row].FontStyle = FontStyles.Italic;
- }
- else
- {
- grid.Rows[row].FontWeight = FontWeights.Thin;
- grid.Rows[row].FontStyle = FontStyles.Italic;
- }
- }
- }
- }
-
- c1FlexGrid1.CellFactory = new MyCellFactory();
复制代码
在线文档:http://helpcentral.componentone. ... _CellStyle_ctor.htm |