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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid elements and Listbox objects interaction

Thread ID:

Created:

Updated:

Platform:

Replies:

142950 Feb 26,2019 07:16 PM UTC Mar 1,2019 01:28 PM UTC WPF 2
loading
Tags: SfDataGrid
Pedro Henrique
Asked On February 26, 2019 07:16 PM UTC

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.

Shobika Palani [Syncfusion]
Replied On February 27, 2019 01:23 PM UTC

Hi Pedro, 

Thank you for contacting Syncfusion Support. 

Currently we are trying to reproduce the reported issue from our end and we will update you with more details on 1st March,2019. 

Regards,
Shobika. 


Shobika Palani [Syncfusion]
Replied On March 1, 2019 01:28 PM UTC

Hi Pedro, 

Thanks for your patience. We have prepared a simple sample based on your query and we have tried to replicate the issue that you were reported.  

Please find the demo sample and video from the below link 
Sample Link: 

Video Link: 

Can you please confirm whether you are reporting the issue that we are have replicated in the above video? If yes, this is because, you are creating new instance for viewmodel each time, due to this, the reported issue occurs. Instead, you can directly access existing datacontext of datagrid and add selected item from listbox. If the reported issue is different from the one we replicated, please revert us with the modified sample/Video illustrating the replication procedure, in order to investigate further and provide appropriate solution at earlier. 

Regards, 
Shobika. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

;