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.

GridStyleInfo constructor not copying?

Thread ID:

Created:

Updated:

Platform:

Replies:

21184 Nov 3,2004 08:52 PM Nov 5,2004 02:06 AM Windows Forms 3
loading
Tags: GridControl
Sue Harris
Asked On November 3, 2004 08:52 PM

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 04:32 AM

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 2.1.0.9. Can you post a sample showing the problem?

Sue Harris
Replied On November 4, 2004 09:38 PM

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 02:06 AM

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();

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.

;