I have an app that receives XML from a server. I want to bind the data to a data grid and it would be grate if the grid auto generated the columns. So far I have tried to this much in my code.
XAML page:
<data:DataGrid x:Name="Status" ItemsSource="{Binding}" AutoGenerateColumns="True">
</data:DataGrid>
Code behind for the page:
void Status_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
XElement recordSet = XElement.Load(e.Result);
CamerasStatusTabDataGrid.ItemsSource = recordSet.Elements("Status");
}
XML from the server:
<StatusReport>
<Status Description="Spilled Coffe on Server" Date="2/5/2009" />
<Status Description="Mice in Copier" Date="4/3/2008" />
<Status Description="Helped User Find Any Key" Date="6/2/2008" />
</StatusReport>
What I am looking to do is to have the status be a row in the grid with "Description" and "Date" being columns.