I'm doing some rapid prototyping and is trying to mock out an admin interface for a website and went with WCF RIA Services. I'm able to expose and consume the domain services from server to client, but I'm struggling with getting columns autogenerated in the datagrid when the result of the query on the server holds no data.
<riaControls:DomainDataSource Name="domainDataSource1"
LoadSize="20" QueryName="GetUsers" AutoLoad="True" >
<riaControls:DomainDataSource.DomainContext>
<ds:CobraDomainContext />
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
<sdk:DataGrid ItemsSource="{Binding Data, ElementName=domainDataSource1}" AutoGenerateColumns="True" IsReadOnly="False" Width="250" Height="150" >
</sdk:DataGrid>
This renders an empty 250x150 datagrid (no columns/no rows). I was expecting that the colunms for the user entity were displayed even though no data was returned from the server since the view would kind of suck otherwise initially. My brain can't can't seem to figure out what is wrong, so I'll crowdsource with stackoverflow.
UPDATE: I was kind of expecting the result from the query to be a typed enumeration, but it appears that the result of the query on the DomainDataService is just IEnumerable but not typed, so the internal logic needs to look into the list to discover what kind of data it is containing.
So the updated question is: Can I give the DataGrid a hint on what type of data will be returned or otherwise autogenerate columns in the grid (through XAML or code)??