private void Button_Click(object sender, RoutedEventArgs e)
{
(this.sfGrid.DataContext as UserInfoViewModel).UserDetails.Add(new UserInfo() { UserId=4001, Name="George", DateofBirth=DateTime.Now, City="Kolalambur",Salary=52000 });
} |
Hi Azem,You can achieve your requirement for adding a new row at rime like blow,
private void Button_Click(object sender, RoutedEventArgs e){(this.sfGrid.DataContext as UserInfoViewModel).UserDetails.Add(new UserInfo() { UserId=4001, Name="George", DateofBirth=DateTime.Now, City="Kolalambur",Salary=52000 });}Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridDemo-339837510.zipAlso we already have a kb to add the new row programmatically,Kb Link:https://www.syncfusion.com/kb/5918/how-to-do-addnewrow-operations-programmatically-in-the-sfdatagridRegards,Jai Ganesh S
Hi Azem,You can achieve your requirement for adding a new row at rime like blow,
private void Button_Click(object sender, RoutedEventArgs e){(this.sfGrid.DataContext as UserInfoViewModel).UserDetails.Add(new UserInfo() { UserId=4001, Name="George", DateofBirth=DateTime.Now, City="Kolalambur",Salary=52000 });}Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridDemo-339837510.zipAlso we already have a kb to add the new row programmatically,Kb Link:https://www.syncfusion.com/kb/5918/how-to-do-addnewrow-operations-programmatically-in-the-sfdatagridRegards,Jai Ganesh SHello, Syncfusion team!necessarily must be the source in SfDataGrid?Thanks!
private void Button_Click(object sender, RoutedEventArgs e)
{
//To insert rows (Param : 5 => insert row index , 2=> number of rows to be inserted)
this.cellGrid.Model.InsertRows(5, 2);
} |
Hi Azem,We cannot understand your requirement clearly. But we suspect that you want to add the new row at run time without using the Collection. This requirement can be achieved in SfCellGrid by inserting the rows at runtime like below,
private void Button_Click(object sender, RoutedEventArgs e){//To insert rows (Param : 5 => insert row index , 2=> number of rows to be inserted)this.cellGrid.Model.InsertRows(5, 2);}Regards,Jai Ganesh S