I have a DataGrid bound to an XML file. The user can edit the rows but I can't seem to get it to allow them to add rows.
Here is the XML File:
<?xml version="1.0" encoding="utf-8"?>
<Golf>
  <Golfers>
    <Golfer Name="John User" Handicap="87" Playing="True" />
    <Golfer Name="Betty Boop" Handicap="85" Playing="true" />
    <Golfer Name="Pro Master" Handicap="87" Palying="False" />
  </Golfers>
  <Courses>
    <Course Name="Course 1" Par="3" HasFront9="True" HasBack9="false" />
    <Course Name="Course 2" Par="3" HasFront9="False" HasBack9="True" />
    <Course Name="Course 3" Par="5" HasFront9="True" HasBack9="True" />
  </Courses>
</Golf>
Here is the XAML for the DataGrid
<DataGrid x:Name="GolfersDataGrid" HorizontalAlignment="Left" Margin="10,10,0,10" Width="227" CanUserAddRows="True"
          ItemsSource="{Binding Path=Elements[Golfer]}" MinColumnWidth="10" AutoGenerateColumns="False" BorderThickness="1" GridLinesVisibility="Horizontal" ColumnWidth="Auto">
    <DataGrid.Columns>
        <DataGridCheckBoxColumn Header="Playing" Width="SizeToCells" Binding="{Binding Path=Attribute[Playing].Value}"/>
        <DataGridTextColumn Header="Golfer" Binding="{Binding Path=Attribute[Name].Value}"/>
        <DataGridTextColumn Header="Handicap" Binding="{Binding Path=Attribute[Handicap].Value}"/>
    </DataGrid.Columns>
</DataGrid>
Here is the code:
public XElement mGolfersList = XElement.Load("Resources\\Golf.xml");
private IEnumerable<XElement> mGolfers = null;
public MainWindow()
{
    InitializeComponent();
    mGolfers = from Golfer in mGolfersList.Elements("Golfers")
              select Golfer;
    GolfersDataGrid.DataContext = mGolfers;
}
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
    mGolfersList.Save("Resources\\Golf.xml");
}