I have a master grid, used for finding items, then a set of 3 grids below it to shown parallel sets of related details for the selected row using simple Name Value pairs.
It looks like this:
When I breakpoint the Domain Service the parameters from the selected row are passed to it correctly, but the child grids are showing entries unrelated to the data returned.
A debug version of one of the 3 Domain Service methods looks like:
public IEnumerable<NameValuePair> GetRandNameValues(int randId)
{
// If I breakpoint here the values in randId are
// correct for the selected master row
List<NameValuePair> result = new List<NameValuePair>();
result.Add(new NameValuePair("[ID]", randId.ToString()));
...
return result;
}
An example of one of the 3 child RadGridViews is:
<telerik:RadGridView Grid.Row="1" Grid.Column="2" HorizontalAlignment="Stretch" Name="randGridView" VerticalAlignment="Stretch" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
ItemsSource="{Binding ElementName=randDataSource, Path=Data}" AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" IsReadOnly="True" Width="*" />
<telerik:GridViewDataColumn Header="Value" DataMemberBinding="{Binding Value}" IsReadOnly="True" Width="*" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
An example of one of the 3 child DomainDataSource objects is:
<riaControls:DomainDataSource Name="randDataSource" Height="0" Width="0"
QueryName="GetRandNameValuesQuery">
<riaControls:DomainDataSource.DomainContext>
<my:RandDomainContext />
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.QueryParameters>
<riaControls:Parameter ParameterName="randId"
Value="{Binding ElementName=masterGridView, Path=SelectedItem.Rand_ID}"/>
</riaControls:DomainDataSource.QueryParameters>
</riaControls:DomainDataSource>
Which should return the key value passed, in this test case, but it always shows a value of 0 like this:
The 0 is from the initial case where nothing is selected. Other rows in the detail grid change, but not to the correct records. In fact they seem to alternate between a small set of values relating to a couple of master rows.... weird.
The DomainService is being called at the correct times with the correct keys, but the return values are wrong.
What triggers the update of the child grids? What am I missing? Why are they showing old data in some, but not all rows?
Update:
I added a handler for the LoadedData
event on the datasource and find when I breakpoint it the entities within it are the wrong values... i.e. not what the domain service selected:
private void randDataSource_LoadedData(object sender, LoadedDataEventArgs e)
{
if (e.HasError)
{
System.Windows.MessageBox.Show(e.Error.ToString(), "Rand Load Error", System.Windows.MessageBoxButton.OK);
e.MarkErrorAsHandled();
}
}
When I replaced the cross-binding to the Grid selection, shown above, with 3 separate load calls on 3 separate domain contexts it works fine. The problem seems to be in binding DomainDataSource parameters to the selection change on the Grid.
Any ideas?