Editing Data in a Child Window with RIA and Silverlight 4
Can I edit data in the SilverLight Child window when using RIA and Silverlight 4? This seems like a fairly simple question, but I have not been able to get any combination of scripts to work.
To put it simply, I am viewing data in a grid that has been populated via a DomainDataSource. Rather than editing the data in one screen (this is the template all Microsoft samples seem to use), I want to open a child window, edit the data, and return. Of course, this is a general design pattern.
If anyone knows a sample that uses this template, a link would be much appreciated.
Thanks, Rick Arthur
a source to share
This is a Microsoft sample that uses ChildWindow . It uses RIA services, but not MVVM.
This is not a problem I am having when objects are bound to my context before I want them to be , but does what you are looking for other than that.
Here is the relevant code to save the ZIP download:
private void addNewEmployee_Click(object sender, RoutedEventArgs e)
{
EmployeeRegistrationWindow addEmp = new EmployeeRegistrationWindow();
addEmp.Closed += new EventHandler(addEmp_Closed);
addEmp.Show();
}
public partial class EmployeeRegistrationWindow : ChildWindow
{
public EmployeeRegistrationWindow()
{
InitializeComponent();
NewEmployee = new Employee();
addEmployeeDataForm.CurrentItem = NewEmployee;
addEmployeeDataForm.BeginEdit();
}
private void OKButton_Click(object sender, RoutedEventArgs e)
{
addEmployeeDataForm.CommitEdit();
this.DialogResult = true;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
NewEmployee = null;
addEmployeeDataForm.CancelEdit();
this.DialogResult = false;
}
public Employee NewEmployee { get; set; }
}
a source to share