Hi all,
I've got a custom collection AllItems. Each item within this has string Make, string Model and List<stockitem> StockItems.
I have a datagrid bound to this custom collection showing the Make, Model and StockItems.Count. This works fine, but when the user clicks on one of the rows I have another datagrid to show the expanded details withing StockItems.
So effectively my 2nd datagrid needs to be bound to StockItems and also the Make and Model. I can bind two columns to StockItems, but I then wish to have the further details shown next to that data as follows:
datagrid 1 - ItemsSource is set to AllItems
<DataGrid x:Name="datagridStockMovements" AlternatingRowremoved="#FFE2E2E2" IsReadOnly="True" AlternationCount="2" AutoGenerateColumns="False" MouseDown="datagridStockMovements_MouseDown" Visibility="Hidden">
<DataGrid.Columns>
<DataGridTextColumn Header="Manufacturer" MinWidth="200" Binding="{Binding Path=Manufacturer}" />
<DataGridTextColumn Header="Model" MinWidth="200" Binding="{Binding Path=ModelName}" />
<DataGridTemplateColumn Header="Quantity" MinWidth="200">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding Path=ListOfDevices.Count}" />
</DockPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn >
</DataGrid.Columns>
</DataGrid>
datagrid2 - ItemsSource is set to StockItems and also needs to include AllItems.Model & AllItems.Manufacturer
<DataGrid x:Name="datagridStockMovementDetails" Grid.Row="1" IsReadOnly="True" AlternatingRowremoved="#FFE2E2E2" AlternationCount="2" AutoGenerateColumns="False" Visibility="Hidden">
<DataGrid.Columns>
<DataGridTextColumn Header="Serial" MinWidth="200" Binding="{Binding Path=Serial}" />
<DataGridTextColumn Header="Machine Name" MinWidth="200" Binding="{Binding Path=MachineName}" />
<DataGridTextColumn Header="Model" MinWidth="200" Binding="{Binding Path=Parent.Model}" />
<DataGridTextColumn Header="Make" MinWidth="200" Binding="{Binding Path=Parent.Manufacturer}" />
</DataGrid.Columns>
</DataGrid>
I'm struggling to explain this well I feel, but it seems that in the expanded datagrid I'm binding to the list within my custom object, then I also want to take the details of Make and Model into that binding with XAML.
Anyone know how to do this?
Regards,
Jib