using Syncfusion.UI.Xaml.Grid.Helpers;
using Syncfusion.UI.Xaml.Grid;
private void buttonAddDetail_Click(object sender, RoutedEventArgs e)
{
var context = this.DataContext as ViewModel;
var rec1 = context.OrdersDetails[4];
var rec2 = context.OrdersDetails[3];
rec2.OrderDetails.Add(new OrderDetails(1111, 7, 7, 7, 7, "7", DateTime.Now));
if (rec1.OrderDetails.Count == 0)
{
// Whether the child records count is zero, you should invoke the UpdateDataRow method when a new record added in runtime.
rec1.OrderDetails.Add(new OrderDetails(2222, 8, 8, 8, 8, "8", DateTime.Now));
this.dataGrid.UpdateDataRow(this.dataGrid.ResolveToRowIndex(rec1));
}
} |