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.
While using a GridControl component I am trying to maintain a reference between each grid cell (GridStyleInfo object) and a underlying cell model of my of design (Class ModelCell).
I have tried to do this by setting a reference in the GridStyleInfo.Tag field of each cell, so it points to the correct underlying ModelCell.
This works well until I use the copy-paste features of the gridControl instance. The problem is that the GridStyleInfo.Tag field is copied along with all the other state in the GridStyleInfo object - thereby overwriting the ModelCell reference of the destination GridStyleInfo.Tag.
In other words: Several GridStyleInfo.Tag fields end up referencing the same ModelCell, while some ModelCells are left unreferenced.
My question is: Is it possible for the copy/paste functions to ignore the GridStyleInfo.Tag field (not likely), or alternatly - does anybody know of a way to maintain such a connection as described above.
Are you doing anything different than what the sample does?
TSThomas Stubbe TeglbjaergSeptember 8, 2006 12:24 PM UTC
Thank you for the reply !
Sorry i forgot to mention we are using VS. 2005, .NET 2.0 runtime and Essential Studio v. 4.1.0.62 as out development platform.
I''ve tried your example (*) and it runs as I would expect it to, that is; references to ModelCells which are keept in the Tag fields are _not_ copied while performing copy-paste operations in the grid, thereby maintaning the references to the ModelCells correctly.
Further investigation reveals that when the ModelCell class is marked with the [Serializeable] attribute - as our ModelCell class is - the Tag field of the target GridStyleInfo object is set to null after performing a paste operation.
Is this by design ? If so do you how this is normally handled ?
Do i understand it correctly if i assume the Tag field of the GridStyleInfo object is _not_ to be copied ?
Another thing i''ve noticed playing around with your example, is that GetObjectData() is never called when even though i''ve explicitly told ModelCell to implement ISerializable (ie, ModelCell : ISerializable). This is not the case if ModelCell i _also_ tagged with the [Serializeable] attribute - in that case GetObjectData() is called when pasting into the grid.
to make it compile - but figured it wasn''t relevant to the problem at hand.
ADAdministrator Syncfusion Team September 9, 2006 09:29 AM UTC
We are still working on this. There may be something broken in the style.ModifyStyle code.
But if all you need to do is to copy/paste values among the cells (and not copy other cell aspects like backcolor, etc.), then you can just tell the grid to copy the text. This will avoid affecting the Tag values which is what you are looking for. You can tell the grid to only copy text using this property setting.
If you really do need to copy all style properties except the tag, this can be done by handling an event like ClipboardPaste and doing the work yourself avoiding the library style-paste code.
TSThomas Stubbe TeglbjaergSeptember 11, 2006 02:23 PM UTC