[DataGridActivity.cs]
protected override void OnCreate(Bundle savedInstanceState)
{
......
_dataGrid = new SfDataGrid(this);
_dataGrid.GridViewCreated += _dataGrid_GridViewCreated;
.....
}
private void _dataGrid_GridViewCreated(object sender, GridViewCreatedEventArgs e)
{
_dataGrid.View.LiveDataUpdateMode = Syncfusion.Data.LiveDataUpdateMode.AllowDataShaping;
}
[ViewModel.cs]
public class ViewModel : INotifyPropertyChanged
{
private ObservableCollection<OrderInfo> ordersInfo;
public ObservableCollection<OrderInfo> OrdersInfo
{
get { return ordersInfo; }
set
{
ordersInfo = value;
RaisePropertyChanged("OrdersInfo");
}
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string name)
{
if (PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
}
#endregion
}
[OrderInfo.cs]
public class OrderInfo : INotifyPropertyChanged
{
...........
public OrderInfo()
{
}
public int OrderID
{
get
{
return _orderID;
}
set
{
this._orderID = value;
RaisePropertyChanged("OrderID");
}
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string name)
{
if (PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
}
#endregion
} |
Hi Utemar,Thanks for the update.We have analyzed the issue the cell value updating in button click and change of different collection at run time are working fine in our end. We suspect that you have not implemented the “INotifyPropertyChanged” for your under-line collection’s and property. If we implemented the “INotifyPropertyChanged” it will automatically be reflected the data changes in view.Please refer the below code snippet, sample and video.Code snippet [C#]
[DataGridActivity.cs]protected override void OnCreate(Bundle savedInstanceState){......_dataGrid = new SfDataGrid(this);_dataGrid.GridViewCreated += _dataGrid_GridViewCreated;.....}private void _dataGrid_GridViewCreated(object sender, GridViewCreatedEventArgs e){_dataGrid.View.LiveDataUpdateMode = Syncfusion.Data.LiveDataUpdateMode.AllowDataShaping;}[ViewModel.cs]public class ViewModel : INotifyPropertyChanged{private ObservableCollection<OrderInfo> ordersInfo;public ObservableCollection<OrderInfo> OrdersInfo{get { return ordersInfo; }set{ordersInfo = value;RaisePropertyChanged("OrdersInfo");}}#region INotifyPropertyChangedpublic event PropertyChangedEventHandler PropertyChanged;private void RaisePropertyChanged(string name){if (PropertyChanged != null)this.PropertyChanged(this, new PropertyChangedEventArgs(name));}#endregion}[OrderInfo.cs]public class OrderInfo : INotifyPropertyChanged{...........public OrderInfo(){}public int OrderID{get{return _orderID;}set{this._orderID = value;RaisePropertyChanged("OrderID");}}#region INotifyPropertyChangedpublic event PropertyChangedEventHandler PropertyChanged;private void RaisePropertyChanged(string name){if (PropertyChanged != null)this.PropertyChanged(this, new PropertyChangedEventArgs(name));}#endregion}Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridDemo1446387524Please let us know, if you need any further other assistance from us.Regards,Balasubramani Sundaram
Hi Utemar,Thanks for your update,Based on your provided code snippet we suspect that you're using a Xamarin. Forms platform because in the earlier update we have provided the sample based on your selection of Xamarin.Android in platform tag.Now, we have prepared a sample in Xamarin. Forms and based on your code snippet we did the implementation with INotifyPropertyChanged in our application and it’s working fine when we change the value on any one of the No_1 or No_2 column value and click the button to do business logic are working fine. For more details please refer the below sample.Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridDemo566113533We hope this helps. Please let us know, if you need any further assistance.Regards,
Balasubramani Sundaram.