If you drag and drop a ‘Details’ form from the DataSources window onto a Silverlight form, by default you won’t have any add or save ability. To fix this, you have to add buttons to the form to do the Insert and Delete. The code behind for those buttons looks like this:
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
Web.Models.UserEdit newUser = new Web.Models.UserEdit();
userEditDomainDataSource.DataView.Add(newUser);
}
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
userEditDomainDataSource.DataView.Remove(userEditDomainDataSource.DataView.CurrentItem);
}
No comments:
Post a Comment