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.
ADAdministrator Syncfusion Team August 5, 2005 09:37 AM
Sorry, my mistake. grid.Rowstyles will work. I just had some code in the wrong order.
ADAdministrator Syncfusion Team August 5, 2005 09:40 AM
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.
ADAdministrator Syncfusion Team August 5, 2005 10:24 AM
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.
ADAdministrator Syncfusion Team August 5, 2005 10:50 AM
No, it''s not a GridDataBoundGrid. It''s just a regular GridControl.
ADAdministrator Syncfusion Team August 5, 2005 11:06 AM
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.
ADAdministrator Syncfusion Team August 5, 2005 01:17 PM
>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:
'' 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
ADAdministrator Syncfusion Team August 5, 2005 05:26 PM
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)
ADAdministrator Syncfusion Team August 11, 2005 10:16 AM