This is a migrated thread and some comments may be shown as answers.

RadDataGrid Two way binding

2 Answers 48 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 22 Jul 2020, 01:27 PM

Can a RadDataGrid have a two way binding?

Whenever I edit a cell in the following TwoWay binded grid, the source collection is not updated. Is this the defined behaviour?

 

 

<tg:RadDataGrid x:Name="radGrid"
Grid.Row="1"
  Style="{StaticResource RadDataGridInsideStyle}"
  ColumnDataOperationsMode="Inline"
  ItemsSource="{x:Bind ViewModel.TrainingsSummary, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  AutoGenerateColumns="False"
  UserGroupMode="Disabled"
  UserEditMode="None"
  MinWidth="400"

 

The source collection is defined as follows:

 

public ObservableCollection<OverviewTrainingsReportDTO> TrainingsSummary { get; set; } = new ObservableCollection<OverviewTrainingsReportDTO>();

 

 

 

2 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 22 Jul 2020, 02:35 PM
[quote]Eric said:

Can a RadDataGrid have a two way binding?

Whenever I edit a cell in the following TwoWay binded grid, the source collection is not updated. Is this the defined behaviour?

[/quote]

 

 

I verified that the binding does work. The problem instead is related to persistence issues

0
Didi
Telerik team
answered on 23 Jul 2020, 09:22 AM

Hi Eric,

Yes you can set TwoWay binding mode to the RadDataGrid itemssource. 

Could you please verify that you have implemented the INotifyPropertyChanged interface inside the business model.

For more details on this please review the following link from the Microsoft documentation: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.data.inotifypropertychanged.propertychanged?view=winrt-19041

Give this a try and let me know how it goes.

Regards,
Didi
Progress Telerik

Tags
DataGrid
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Didi
Telerik team
Share this question
or