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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Override columnstyle with rowstyle in GDBG?

Thread ID:

Created:

Updated:

Platform:

Replies:

36736 Nov 9,2005 09:17 AM UTC Nov 10,2005 10:37 AM UTC WinForms 4
loading
Tags: GridControl
Tomas
Asked On November 9, 2005 09:17 AM UTC

I''m trying to set a rowstyle that should "override" the current style for all cells in the row. I have some columnstyles defined, but I would like the rowstyle to take precendence over this. All cells that doesn''t have any style set through its columnstyle get the new backcolor but the others keep their columnstyle color. I use this code in my QueryCellInfo event: if(e.ColIndex == -1 && e.RowIndex == somerowindex) { e.Style.ReadOnly = true; e.Style.BackColor = Color.LightGray; }

Administrator [Syncfusion]
Replied On November 9, 2005 11:26 AM UTC

Hi Tomas, Once you have set a style.ReadOnly = true;, you must then set grid.IgnoreReadOnly to be able to change it. Please try this sample.It seems to be working fine. RowStyleOverrideColStyle.zip Please refer this sample for more details: C:\program files\syncfusion\essential studio\3.3.0.0\Windows\Grid.Windows\samples\Quick Start\GridStyleInfoAtWork Let us know if this helps. Best Regards, Jeba.

Tomas
Replied On November 9, 2005 11:49 AM UTC

Thank you Jeba. It seems that there is a difference between setting the columsstyle using: grid.Binder.InternalColumns[3].StyleInfo.BackColor and the way you did when it worked: grid.Model.ColStyles[3].BackColor How come there is a difference and is your way prefered always?

Administrator [Syncfusion]
Replied On November 9, 2005 01:28 PM UTC

Setting the column style using Model.ColStyles will make the column style ''obey'' the style precedences shown in the GridStyleInfoAtWork. These precedences work on the Model level (or GridControl) level. But GridDataBoundGrid adds an extra style level (GridBoundColumn.StyleInfo object for each column) for columns which takes precedence over the Model level Colstyles/RowStyles. So, setting GridBoundColumn.StyleInfo overrides the properties that were set using ColStyles. In general, if you want to try to use the fact that RowStyles take precedence over column styles in a GridDataBoundGrid, then you would want to avoid using GridBoundColumn.StyleInfo to set style properties and use Model.ColStyles instead. But it is this GridBoundColumn.StyleInfo property that you have access to through the GriddataBoundGrid designer. So, if you are setting such properties as design time and want to have a property take precedence over the GridBoundColumn.StyleInfo set property, then in QueryCellInfo, instead of checking e.ColIndex == -1, you could check e.Colindex > 0. This would effectively set the cell style for the grid cell, and this will ovrride the setting from GridBoundColumn.StyleInfo.

Tomas
Replied On November 10, 2005 10:37 AM UTC

Thanks Clay, it all makes sense now.

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.

Warning Icon 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.Close Icon

;