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

BaseStyle use in QueryCellInfo event

I have created some extra BaseStyles that I want to use formatting specific cells in QueryCellInfo event. .... e.Style.BaseStyle = "CustomBaseStyle1"; .... Some of the custom BaseStyles I'm creating don't have ANY effect on the cell styles. For example "CustomBaseStyle1" has the following definition when it's created: customBaseStyle1.ReadOnly = true; customBaseStyle1.BackColor = Color.LightGray; customBaseStyle1.TextColor = Color.LightGray; GridBaseStyle newBaseStyle = new GridBaseStyle("CustomBaseStyle1", false, disabledCellStyleInfo); gridDataBound.BaseStylesMap.AddRange(new GridBaseStyle[1] {newBaseStyle}); Question: ----------------- Why the ReadOnly property doesn't have any impact when I change the BaseStyle in a cell to the CustomBaseStyle1? Should I change the style using ChangeCells(GridRangeInfo.Cells(1, 1, 2, 2), style, StyleModifyType.Override) ?

3 Replies

AD Administrator Syncfusion Team July 30, 2003 02:44 AM UTC

It should work fine. We made a fix regarding read-only settings after 1.6.1.0. You should check it with our latest private patch and let us know if the problem still exists. However, please do also note that if the cell has any explicit settings, these will always have higher precedence than the base style settings. For example, if you explicitly have set the BackColor for a cell the cells back color will be used and not the one of the base style. Also, in your sample code above please note that you initialize "customBaseStyle1" but then you assign "disabledCellStyleInfo" to the base style (but I guess that's just a problem with the snippet you created to describe your situation and you use the right objects in your program ...) Stefan


AD Administrator Syncfusion Team July 30, 2003 05:43 PM UTC

> > It should work fine. We made a fix regarding read-only settings after 1.6.1.0. You should check it with our latest private patch and let us know if the problem still exists. > > However, please do also note that if the cell has any explicit settings, these will always have higher precedence than the base style settings. For example, if you explicitly have set the BackColor for a cell the cells back color will be used and not the one of the base style. > > Also, in your sample code above please note that you initialize "customBaseStyle1" but then you assign "disabledCellStyleInfo" to the base style (but I guess that's just a problem with the snippet you created to describe your situation and you use the right objects in your program ...) > > Stefan I'm going to test using 1.6.5 and let you know the results. About setting the baseStyle to a cell, what do I have to do to override the cell style "completely" with the new basestyle? What style settings are considered explicit? Regards, Jose


AD Administrator Syncfusion Team July 30, 2003 06:02 PM UTC

You would have to reset these properties then in the specific style, e.g. style.ResetInterior. Then the style will inherit interior from a base style. If you want to force style settings onto a style object, then you could call style.ModifyStyle(baseStyle, ModifyStyle.Override); this will copy over settings from baseStyle into the style object. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon