The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator Syncfusion Team 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 2.1.0.9.
Can you post a sample showing the problem?
SHSue HarrisNovember 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.
ADAdministrator Syncfusion Team 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();