We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ColumnHeaderCell and GridTableCellStyleInfo

I have assigned a GridTableCellStyleInfo to the ColumHeaderCell but the style does not appear until I click (and hold the mouse down) on the header cell, as required to sort the column. Is it possible to display assigned style without clicking on it? I tryed the following line; grid.Appearance.ColumnHeaderCell.Themed = false; but this had no effect. Thank you for your help

4 Replies

AD Administrator Syncfusion Team September 28, 2005 02:20 AM UTC

Simon, I attached a sample. Look at the ctor. It sets the column header back color to green and just works fine. CS.zip Let me know if you do something different. Thanks, Stefan >I have assigned a GridTableCellStyleInfo to the ColumHeaderCell but the style does not appear until I click (and hold the mouse down) on the header cell, as required to sort the column. Is it possible to display assigned style without clicking on it? I tryed the following line; grid.Appearance.ColumnHeaderCell.Themed = false; but this had no effect. > >Thank you for your help


AD Administrator Syncfusion Team September 28, 2005 05:20 AM UTC

Hi Stefan, Thanks for your reply and the example code. I am able set the backcolor of the ColumnHeaderCells in my grid, using the sample code that you supplied. However, I am unable to set the GridTableCellStyleInfo of the ColumnHeaderCells. The code I use is below: GridTableCellStyleInfo cellstyle = new GridTableCellStyleInfo(); cellstyle.BaseStyle = "Header"; grid.BorderStyle = BorderStyle.FixedSingle; cellstyle.Interior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, SystemColors.Control, SystemColors.ControlLightLight); cellstyle.Borders.Top = new GridBorder(GridBorderStyle.Solid, SystemColors.ControlLightLight, GridBorderWeight.Thin); cellstyle.Borders.Left = new GridBorder(GridBorderStyle.Solid, SystemColors.ControlLightLight, GridBorderWeight.Thin); cellstyle.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, SystemColors.ActiveBorder, GridBorderWeight.Thin); cellstyle.Borders.Right = new GridBorder(GridBorderStyle.Solid, SystemColors.ActiveBorder, GridBorderWeight.Thin); Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Horizontal, SystemColors.Control, SystemColors.ControlLightLight); Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.ForwardDiagonal, SystemColors.Control, SystemColors.ControlLightLight); grid.Appearance.ColumnHeaderCell.Themed = false; grid.Appearance.ColumnHeaderCell = cellstyle; Thanks again for your help, Simon


AD Administrator Syncfusion Team September 28, 2005 11:08 AM UTC

Hi Simon, Try setting this in the QueryCellStyleInfo event handler to see if that helps. GridTableCellStyleInfo cellstyle; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); cellstyle = new GridTableCellStyleInfo(); cellstyle.BaseStyle = "Header"; cellstyle.Interior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, SystemColors.Control, SystemColors.ControlLightLight); cellstyle.Borders.Top = new GridBorder(GridBorderStyle.Solid, SystemColors.ControlLightLight, GridBorderWeight.Thin); cellstyle.Borders.Left = new GridBorder(GridBorderStyle.Solid, SystemColors.ControlLightLight, GridBorderWeight.Thin); cellstyle.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, SystemColors.ActiveBorder, GridBorderWeight.Thin); cellstyle.Borders.Right = new GridBorder(GridBorderStyle.Solid, SystemColors.ActiveBorder, GridBorderWeight.Thin); this.gridGroupingControl1.QueryCellStyleInfo +=new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo); } private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { if(e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.ColumnHeader) { e.Style.Themed = false; e.Style.ModifyStyle(this.cellstyle, Syncfusion.Styles.StyleModifyType.Override); } } Best regards, Jay N


AD Administrator Syncfusion Team September 28, 2005 11:43 PM UTC

Hi Jay, thanks for your help, the code works well.

Loader.
Live Chat Icon For mobile
Up arrow icon