New columns and serialized layout not knowing the new columns

I'm using a SfDataGrid with AutoGenerateColumns="False" and I'm using the serialization of the SfDataGrid (SerializeColumns = true, DeserializeColumns = true).

In a newer version of my app I've added new columns. Because the app deserializes an "old" version of the columns available the new columns are not shown.

Is it possible to force the new columns to be shown after the first time the SfDataGrid is deserialized?


Thanks in advance.


3 Replies 1 reply marked as answer

CM Chidanand Murugaiah Syncfusion Team December 14, 2023 04:42 PM UTC

Hi Boon,


Currently we are analyzing your requirement, we will provide an update on or before December 18, 2023.


Regards,

Chidanand M.



VS Vijayarasan Sivanandham Syncfusion Team December 18, 2023 06:43 PM UTC

Hi Boon,

Serialization is the process of saving the current properties of SfDataGrid into an XML file document. After applying the deserialization, the saved properties of SfDataGrid are loaded into newly assigned or already serialized SfDataGrid. This is the behavior of Serialization and Deserialization.

However, your requirement to display the new column with deserialized the columns in SfDataGrid can be achieved by customizing the serialization operations by deriving the SerializationController class and overriding the RestoreGridColumns methods. Find the sample demo in the attachment. For more information related to Customizing Serialization, please refer to the below user guide documentation link,

UG Link: Serialization in WPF DataGrid Control | Syncfusion

Note: We have prepared the sample based on like below mentioned example,

The old version of columns in the grid: OrderID

The new version of columns in the grid: CustomerID | CustomerName

The deserialization should lead to this grid: OrderID | CustomerID |
CustomerName

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.



Attachment: Sample_43cb365e.zip

Marked as answer

BO Boon February 20, 2024 10:32 AM UTC

Thank you :-)


Loader.
Up arrow icon