I am trying to enable the user to add new row/data to a DataGrid that is twoway bound to an XML file. I can edit all values, but no matter what I have tried, the blank row at the end of the grid just won't show up.
I am trying to accomplish this mostly in XAML, with minimal code behind. I don't want the user to have to click a button to add the row either (Which I can accomplish).
Here is an example of my DataGrid. It updates my XML file with 0 code behind
<DataGrid Name="masterCrewGrid" CanUserAddRows="True" CanUserDeleteRows="True" DataContext="{StaticResource CrewInfo}" ItemsSource="{Binding XPath=/Names/Name}" AutoGenerateColumns="False" CellEditEnding="masterCrewGrid_CellEditEnding" >
<DataGrid.Columns>
<DataGridTemplateColumn Header="Active">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding XPath=@isActive, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Family Name" Binding="{Binding XPath=Family, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="First Name" Binding="{Binding XPath=First, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Middle Name" Binding="{Binding XPath=Middle, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Birthday" Binding="{Binding XPath=Birthday, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="Crew Position" Binding="{Binding XPath=CrewPosition, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataGrid.Columns>
</DataGrid>
Can somebody please explain why new rows won't show up? Is it something to do with the grid being bound to an XML file?