DataGrid binding from XML XElement

Jan 9, 2009 at 9:45 PM
Edited Jan 9, 2009 at 9:47 PM
I am brand new to using XAML and am having trouble trying to display xml data in a data grid.  
The debugger says it is there, but it does not display the data  in the form.  I just get empty rows and cells. 
Do I need to format anything or set another property on my DataGrid?

-----------------------------
C#

XElement sourceTable;

dataGridMergeProgress.DataContext = sourceTable.Elements(

"TABLE");
--------------------
XAML

  <toolkit:DataGrid Name="dataGridMergeProgress" AutoGenerateColumns="False" ItemsSource="{Binding}" Margin="59.5,213,0,96" IsReadOnly="True" DisplayMemberPath="TABLE">

 

 

 

<toolkit:DataGrid.Columns>

 

 

<toolkit:DataGridTextColumn Header="Table Name" Binding="{Binding Path=Attrbute[Name].Value }"/>

 

<toolkit:DataGridTextColumn Header="Source Count" Binding="{Binding Path=Attrbute[Source].Value}"/>

 

 

 

 

<toolkit:DataGridTextColumn Header="Status" Binding="{Binding Path=Attrbute[Status].Value}"/>  

 

 

 

<toolkit:DataGridTextColumn Header="Copied Count" Binding="{Binding Path=Attrbute[Copied].Value}"/>  

 

 

<toolkit:DataGridTextColumn Header="Message" Binding="{Binding Path=Attrbute[Message].Value}"/>

 

 

</toolkit:DataGrid.Columns 

 

 

</toolkit:DataGrid>



this is what shows up in the debugger as dataGridMergeProgress.Items.Current Item.
+  CurrentItem {<TABLE Name="L_AGENCIES" Source="38" Status="Waiting..." Copied="0" Message="" />} object {System.Xml.Linq.XElement}

 

 

 

 

Jan 15, 2009 at 11:28 AM
If you are binding to XML data, I believe that you want to use XPath and not Path on the Binding.
Jan 16, 2009 at 4:24 PM
It also helps if you spell 'Attribute' correctly.  Thanks for your help.