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.
Unfortunately, activation email could not send to your email. Please try again.

How to get style of individual column header rows?

Thread ID:

Created:

Updated:

Platform:

Replies:

32687 Aug 5,2005 10:35 AM Aug 11,2005 11:16 AM Windows Forms 8
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 5, 2005 10:35 AM

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.

Administrator [Syncfusion]
Replied On August 5, 2005 10:37 AM

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

Administrator [Syncfusion]
Replied On August 5, 2005 10: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.

Administrator [Syncfusion]
Replied On August 5, 2005 11: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.

Administrator [Syncfusion]
Replied On August 5, 2005 11:50 AM

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

Administrator [Syncfusion]
Replied On August 5, 2005 12:06 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? 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

Administrator [Syncfusion]
Replied On August 5, 2005 02: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: 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

Administrator [Syncfusion]
Replied On August 5, 2005 06: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)

Administrator [Syncfusion]
Replied On August 11, 2005 11:16 AM

Thanks. That worked perfectly!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;