Hi friends,
While going through a WPF Core project for CRUD as I came across an example I found that having a Button being placed in a datagrid, against each record, I could implement to the click event a procedure, like the following, to place the data of the same to another grid containing the controls for editing a record:
private void eExclEdit(object sender, RoutedEventArgs e)
{
EditAccNat = (sender as FrameworkElement).DataContext as AccountNature;
GridForEdit.DataContext = EditAccNat;
}
However, trying to avoid using a number of buttons via DataGridTemplateColumn as I tried a number of times to have a similar procedure being tagged to an event of SelectionChanged in a code like the follows, I found the implementation of datacontext failed. Most probably because of the context returned in respect of the Entire Collection of data pertaining to AccountNatures???
private void eAccNatSelectedChanged(object sender, SelectionChangedEventArgs e)
{
EditAccNat = (sender as FrameworkElement).DataContext as AccountNature;
GridForEdit.DataContext = EditAccNat;
}
An example of achieving the same shall be appreciated.
Thanks in advance.