views:

405

answers:

2

Using markup I can't get data to show in the grid:

<riacontrols:DomainDataSource x:Name="EstimatesData"  QueryName="GetUserEstimates" >
    <riacontrols:DomainDataSource.DataContext>
        <ds:MyDomainContext  /> 
    </riacontrols:DomainDataSource.DataContext>
</riacontrols:DomainDataSource>
<datagrid:DataGrid x:Name="EstimatesGrid" ItemsSource="{Binding ElementName=EstimatesData, Path=Data}" />

MyDomainContext has a model UserEstimates with a method GetUserEstimatesQuery.

When the page loads, the breakpoint in GetUserEstimatesQuery does not get hit, the method is not called. There are no errors, what am I missing?

If I write code behind on the page load, it binds OK.

A: 

Forgot to mention the model came from a SQL View. I tried the same approach using a table and it worked fine. The problem was that there was no proper key defined on the model for the view, it had set about 6 fields as the key which would still not give a unique value.

End solution was to add a field to the view to use as the key, re-create the model, set the primary key field, and now data is displaying as expected now.

rotary_engine
A: 

You need to do some debugging of your DomainDataSource usage to see if it's invoking the load at all. Try handling the LoadingData event and the LoadedData event to see what's going on.

This might have some more info that is helpful here: http://jeffhandley.com/archive/2009/11/19/domaindatasource-error-handling-again.aspx

You can also try to call the estimatesData.Load() in your code-behind to see if that helps troubleshoot your issue.

Jeff Handley