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
close icon

Apply changes to GridStyleInfo

Hi there, I am trying to apply the changes from one GridStyleInfo to another. The situation is that I have a toolbar which modifies a GridStyleInfo drawn from the current selection of cells, after which it fires an event which is caught to update the styles in the grid (by firing the SaveCellInfo event). I am only interested in changed properties - if a user clicks bold, I simply want to apply bold formatting to each selection, without destroying their existing formatting. If the user removes a top border, I simply want to remove that top border from the selections. I think that I should be using the GridStyleInfo.ModifyStyle function - however I am having a hard time understanding it''s behaviour. I had thought that StyleModifyType.Changes was the one I needed - but it appears to only add properties that have changed - doesn''t change existing ones or remove remvoed ones. Is this correct? If anyone can help it would me most appreciated. Cheers, TERRY ROSSOW

7 Replies

TR Terence Rossow May 5, 2006 03:23 AM UTC

Here is exactly what I want to do: Given a source and target GridStyleInfo (source comes from a control that modifies the style of a selection, and target is the style used by the grid), if the source has a value for a property, copy that to the target (regardless or whether the target has a value for the property or not). If the source does not have a value for a property that the target does, remove that property value from the target. Cheers, TERRY ROSSOW


AD Administrator Syncfusion Team May 5, 2006 05:20 AM UTC

Hi Terry, Please refer to the below forum thread for more details. http://www.syncfusion.com/support/forums/message.aspx?MessageID=39135 Please let me know if this helps. Best Regards, Haneef


TR Terence Rossow May 7, 2006 11:31 PM UTC

Hi Haneef, Thanks for the reply. What I am actually after here is the exact behaviours of the GridStyleInfo.ModifyStyle function for each of the StyleModifyType enumeration values. The documentation is a little vague, and my own tests of the function have not made it very much clearer to me. Thanks, TERRY ROSSOW


TR Terence Rossow May 8, 2006 01:07 AM UTC

I have a specific example of my confusion here: I have a GridStyleInfo object that applies to a cell in the grid (theCellStyle): {Interior = Pattern; None; WindowText; 255, 204, 0 Format = "#,##0" Borders.Top = Solid; Black; ExtraThin Borders.Bottom = Solid; Black; ExtraThin VerticalAlignment = Middle ShowButtons = ShowCurrentCell } I then have a style that will be applied to the row that the aforementioned cell is in (theRowStyle): {Interior = Pattern; None; WindowText; Lime } What I want to do is remove all the properties that are set in the new row style from style of each cell in the row. So in this case, I want to remove "Interior = etc" from the cell as it is the only thing shared by the cell style or the row style. I call this line of code to attempt to do this: theRowStyle.ModifyStyle(theCellStyle, Syncfusion.Styles.StyleModifyType.Exclude); What I would expect after that operation is that theCellStyle would look like this: {Format = "#,##0" Borders.Top = Solid; Black; ExtraThin Borders.Bottom = Solid; Black; ExtraThin VerticalAlignment = Middle ShowButtons = ShowCurrentCell } However, it actually ends up like this: {Borders.Top = Solid; Black; ExtraThin Borders.Bottom = Solid; Black; ExtraThin } Is this a bug? Or am I doing something wrong? Cheers, TERRY ROSSOW


AD Administrator Syncfusion Team May 9, 2006 05:02 AM UTC

Hi Terry, We regret for the inconvenience caused. We were able to see the issue here and I have logged a bug report. You could track the progress of the issue here: http://www.syncfusion.com/support/issues/grid/Default.aspx?ToDo=view&questId=2040 Thanks for your patience, Regards, Haneef


LK Leow Kah Man July 3, 2006 07:46 AM UTC

Hi, Is this issue still under testing? as specified in http://www.syncfusion.com/support/issues/grid/Default.aspx?ToDo=view&questId=2040 Leow


AD Administrator Syncfusion Team July 3, 2006 03:52 PM UTC

Hi Leow, Thanks for your feedback. This issue has been resolved in Essentail version 4.2. You can download the same from the following link: 4.2V DownloadLink Thanks for your interest in Syncfusion products. Best Regards, Hanef

Loader.
Live Chat Icon For mobile
Up arrow icon