I have small program for edit XML-files. I using XMLDataProvider:
<Grid.DataContext>
<XmlDataProvider x:Name="XMLData" Source="/database/stroyka1.bas" XPath="JobArray/job"/>
</Grid.DataContext>
and DataGrid:
<DataGrid
Name="JobsDataGrid"
ItemsSource="{Binding}"
AutoGenerateColumns="false" Height="Auto" Width="Auto"
IsReadOnly="False" CanUserAddRows="True">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding XPath=id, Mode=TwoWay}" />
<DataGridTextColumn Header="Название" Binding="{Binding XPath=name, Mode=TwoWay}" />
<DataGridTextColumn Header="Цена за единицу" Binding="{Binding XPath=price, Mode=TwoWay}"/>
<DataGridTextColumn Header="Единица измерения" Binding="{Binding XPath=measure, Mode=TwoWay}"/>
</DataGrid.Columns>
</DataGrid>
How to enable a blank row below the table? CanUserAddRow=true
and IsReadOnly=false
not work. I tried add row with blank parameters to DataGrid, but have error:
Operation is not allowed when using ItemsSource. Instead, access and modify elements using ItemsControl.ItemsSource.