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

GridStyleInfo constructor not copying?

Thread ID:





21184 Nov 4,2004 01:52 AM UTC Nov 5,2004 07:06 AM UTC WinForms 3
Tags: GridControl
Sue Harris
Asked On November 4, 2004 01:52 AM UTC

Hi, I want to copy a style so that I can make alterations without modifying the original style object. I thought that the copy constructor would be what was required but somethings going wrong. I call: Syncfusion.Windows.Forms.Grid.GridStyleInfo copyStyle = new Syncfusion.Windows.Forms.Grid.GridStyleInfo(style); copyStyle.ResetCellValue(); and the original style also loses its cell value. Have I done something wrong? Whats the best way to clone a GridStyleInfo object. Thanks, Sue

Administrator [Syncfusion]
Replied On November 4, 2004 09:32 AM UTC

How are you getting style? I dropped a GridControl and button on a form. In the button handler I used this code. GridStyleInfo copyStyle = new Syncfusion.Windows.Forms.Grid.GridStyleInfo(this.gridControl1[1,1]); copyStyle.ResetCellValue(); I then ran the program typed somethng into cell 1,1, and clicked the button. The value in cell 1,1 did not change. I am using Can you post a sample showing the problem?

Sue Harris
Replied On November 5, 2004 02:38 AM UTC

I''m getting the style as part of a SaveCellInfo event. In the case of my actual code, I''m in a OnSaveCellInfo override (of my override class of the GridControl), and it causes the cell value to be lost when the event is thrown. But it also occurs in the event itself. When I hook the SaveCellInfo event in the Virtual Grid example (no other changes) and try the following code: string cv1 = e.Style.CellValue.ToString(); GridStyleInfo a = new GridStyleInfo(e.Style); a.ResetCellValue(); string cv2 = e.Style.CellValue.ToString(); The cell value in cv2 is empty.

Administrator [Syncfusion]
Replied On November 5, 2004 07:06 AM UTC

I think the problem has to do with using weak references for the passed in style at this point in the code. This code avoided the problem for me. string cv1 = e.Style.CellValue.ToString(); GridStyleInfo a = new GridStyleInfo(); a.CopyFrom(e.Style); a.ResetCellValue(); string cv2 = e.Style.CellValue.ToString();


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon