>Hi,
>
>I have a WPF MM.NET 2010 application. One form is not storing the values entered on the form to the underlying entity so when I save, I get the validation kicking in that the data cannot be null/empty. If I edit an existing record it works fine.
>
>I have this in the XAML file:
>
>
<mmwpf:mmBusinessWindow.DataContext>
> <SamaanSystems_IBC_Business:OutboundLIATRateEntity/>
> </mmwpf:mmBusinessWindow.DataContext>
>
>The New button click has no code in it to override the default MM.net behaviour.
>
>When debugging, the values shown on the form do not match what is in the entity so it looks like the datacontext is being pulled out from underneath the form but I can't find anywhere that is resetting it (and I don't know how to check the current datacontext when debugging).
>
>Any help to push me towards solving this would be great.
I've narrowed this down a bit. My screen consists of two pages. The first page has a navigation grid and the second page shows the details of the selected item from the navigation grid.
My code has this in it:
protected override void Window_Loaded(object sender, RoutedEventArgs e)
{
base.Window_Loaded(sender, e);
mmBindingList<OutboundLIATRateEntity> outboundLIATRate = this.OutboundLIATRate.GetAllOutboundLIATRates();
this.DataContext = this.OutboundLIATRate.DataSet.Tables[this.OutboundLIATRate.TableName].DefaultView;
If I change that code to this:
protected override void Window_Loaded(object sender, RoutedEventArgs e)
{
base.Window_Loaded(sender, e);
this.DataContext = this.OutboundLIATRate.GetAllOutboundLIATRates();
Then everything works, except that I need to show a value from a related table in the navigation grid and that column shows up blank, hence why I was using the DefaultView.
So my question is then how do I set things up properly so that the grid shows the column from the related table and the data entry values get stuck back into the entity when I need them to be so the save will work?