Q:

WPF XML bound DataGrid displaying only one row

I have the following xml doc as my data source:
<?xml version="1.0" encoding="utf-8" ?>
<AccessLauncherCentralConfig>
  <DataTablesForExport>
    <Table>Unit1.Alarm</Table>
    <Table>Unit1.Alarm Categories</Table>
    <Table>Unit1.Alarms Analogue</Table>
  </DataTablesForExport>
  <SqlDbServer>localhost</SqlDbServer>
</AccessLauncherCentralConfig>

I have the following xaml:
<Grid>
        <Grid.Resources>
            <XmlDataProvider x:Key="ConfigData" Source="CentralConfig.xml" XPath="/"/>
        </Grid.Resources>
        <DataGrid x:Name="dgridEmp" ItemsSource="{Binding Source={StaticResource ConfigData}, XPath=AccessLauncherCentralConfig}"
 AutoGenerateColumns="False" Margin="52,89,31,50">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Tables For Export" Binding="{Binding XPath=DataTablesForExport/Table}" />
            </DataGrid.Columns>
        </DataGrid>
    </Grid>

Why does the grid display only the first row (Unit1.Alarm)?

A:

Your XPaths are invalid. Try this:
<DataGrid x:Name="dgridEmp"
          ItemsSource="{Binding Source={StaticResource ConfigData}, XPath=AccessLauncherCentralConfig/DataTablesForExport/Table}"
          AutoGenerateColumns="False" Margin="52,89,31,50">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Tables For Export" Binding="{Binding XPath=.}" />
    </DataGrid.Columns>
</DataGrid>

It will display three rows.

