Binding XElement to Datagrid
<p>I'm trying out XElement binding for the very first time so apologies if this is very silly. I have an XML which I need to bind to DataGrid.</p>

<p>Music.xml:</p>

<pre><code>&lt;Music&gt;
    &lt;Album Title="Chris Sells Live" Artist="Chris Sells" ReleaseDate="2/5/2008" /&gt; 
    &lt;Album Title="The Road to Redmond" Artist="Luka Abrus" ReleaseDate="4/3/2008"/&gt; 
    &lt;Album Title="The Best of Jim Hance" Artist="Jim Hance" ReleaseDate="6/2/2008"/&gt; 
&lt;/Music&gt;
</code></pre>

<p>CodeBehind :</p>

<pre><code>InitializeComponent();
XElement MyMusic = XElement.Load("Music.xml"); 
this.XElementContainer.DataContext = MyMusic.Elements("Album");
</code></pre>

<p>Above code gets the XElement from Music.Xml file</p>

<p>XAML : <code>&lt;DataGrid x:Name="XElementContainer" ItemsSource="{Binding}"/&gt;</code></p>

<p>Output which I'm getting [![It is binding the properties of XElement. I need to bind the child element of specified node i.e Album which has child nodes of Title,Artist and Release Date]</p>

<p><a href="https://i.stack.imgur.com/35jsG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/35jsG.jpg" alt="enter image description here"></a></p>

<p>I'm expecting the output in datagrid where I dont want to create any static DataGridTextColumn. Is it possible to just bind the XElement data and get a result like this?:</p>

<pre><code>Title                 |Artist       |ReleaseDate
    Chris Sells Live       Chris Sells   2/5/2008
    The Road to Redmond    Luka Abrus    4/3/2008
    The Best of Jim Hance  Jim Hance     6/2/2008
</code></pre>