Hello,
I have been trying to get a Listbox to store objects which contains the elements of a SfDataGrid and then, let the user fill the SfDataGrid with the data stored in the object by clicking the Listbox item. The problem I am facing is that once I assign new values to the SfDataGrid elements to create a new object, the values of the already created object (which is already in the Listbox) have their values changed too. How can I avoid that?
What I am doing: I am getting the SfDataGrid's elements through the ItemsSource property and adding them to a new List, which is what my object stores. To get the elements back to he SfDataGrid, I am adding the elements back from this list to a new instance of my view model's ObservableCollection and reassigning the DataContext to this view model. The ItemsSource is also reassigned, but to the ObservableCollection.
Thank you.