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

How to get style of individual column header rows?

Is there a way to get the style of an individual column header row? grid.RowStyles appears to only contain the styles for non-header rows, and grid.BaseStylesMap("Column Header").StyleInfo effects all header rows.

8 Replies

AD Administrator Syncfusion Team August 5, 2005 02:37 PM UTC

Sorry, my mistake. grid.Rowstyles will work. I just had some code in the wrong order.


AD Administrator Syncfusion Team August 5, 2005 02:40 PM UTC

I spoke too soon. I did have the code in the wrong order, but now that that''s fixed, setting the WrapText property to False doesn''t appear to have any effect on an individual header row.


AD Administrator Syncfusion Team August 5, 2005 03:24 PM UTC

Is this a GridDataBoundGrid? If so, try handling PrepareViewStyleInfo. In your handler, if e.RowIndex is 0 and e.ColIndex is equal to grid.Binder.NameToColIndex(colname), then set e.Style.WrapText.


AD Administrator Syncfusion Team August 5, 2005 03:50 PM UTC

No, it''s not a GridDataBoundGrid. It''s just a regular GridControl.


AD Administrator Syncfusion Team August 5, 2005 04:06 PM UTC

I am a little confused. Are you trying to change Row Headers or Column Headers? Do you want to change one cell or a whole row or column of cells? Here is a little sample that changes this property on a single column header cell. http://www.syncfusion.com/Support/user/uploads/GC_header_fb687d8.zip


AD Administrator Syncfusion Team August 5, 2005 06:17 PM UTC

>I am a little confused. Are you trying to change >Row Headers or Column Headers? Do you want to >change one cell or a whole row or column of cells? I will clarify. I have a grid to which I''ve added a second column header row. I want to change the WordWrap property of the second column header row to False. I''m doing this, but it does not seem to work: With Me.MyGrid '' Give the grid two header rows .Rows.HeaderCount = 1 .Rows.FrozenCount = .Rows.HeaderCount '' Set appropriate number of columns and rows .ColCount = 20 .RowCount = .Rows.HeaderCount '' Don''t let text on the second header row be wrapped '' NOTE: Why doesn''t this work? .RowStyles(1).WrapText = False End With


AD Administrator Syncfusion Team August 5, 2005 10:26 PM UTC

The reason this is not working is the header cells get its style from the grid.BaseStylesMap["Header"].StyleInfo. This basestyle setting take precedence over the rowstyles. So, setting a row style property will not ''undo'' what is being set through the basestyle. I think you can do what you want without change thing basestyle (which would also affect the original row header) using code like this: Dim style as New GridStyleInfo style.WrapText = false; Me.gridControl1.ChangeCells(GridRangeInfo.Cells(1,1,1, Me.gridControl1.ColCount), style, Syncfusion.Styles.StyleModifyType.Override)


AD Administrator Syncfusion Team August 11, 2005 03:16 PM UTC

Thanks. That worked perfectly!

Loader.
Live Chat Icon For mobile
Up arrow icon