我有一个分层的数据网格。
<DataGrid Name="dgList" ItemsSource="{Binding List1}" Grid.Row="0" Margin="0,0,0,0"
CanUserAddRows="False" AutoGenerateColumns="False" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="Sub System" Binding="{Binding Path=Name}" IsReadOnly="True"></DataGridTextColumn>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DataGrid Name="dgList2" AutoGenerateColumns="False" ItemsSource="{Binding Name1}" CanUserAddRows="False" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn MinWidth="250" Header="Name3" Binding="{Binding Path=Name3}"></DataGridTextColumn>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<DataGrid Name="List2" AutoGenerateColumns="False" ItemsSource="{Binding List3}" CanUserAddRows="False" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn MinWidth="250" Header="FN" Binding="{Binding Path=FirstName}"></DataGridTextColumn>
<DataGridTextColumn MinWidth="250" Header="LN" Binding="{Binding Path=LastName}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
网格工作正常,单击该行将展开子列表。但是左边的列上是否有箭头或+加号可能表示有更多的行。