У меня есть рабочий пример кода, который использует Entity Framework, который связывает таблицы базы данных SQL. Он использует стандарт DataGrid. Я пытаюсь поменять код, чтобы использовать xamDataGrid, но отсутствует RowDetailsVisibilityMode = "VisibleWhenSelected". Я пытаюсь отобразить 2 сетки и мастер и родительский элемент, чтобы при нажатии на строку в мастере отображались подробности. Затем я могу отредактировать сетку на сетке деталей и обновить базу данных.
Это xaml, который работает:
<DataGrid x:Name="categoriesDataGrid" Grid.Row="0" AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding Source={StaticResource categoriesViewSource}}" Margin="0,0,0,0" RowDetailsVisibilityMode="VisibleWhenSelected">
<DataGrid.Columns>
<DataGridTextColumn x:Name="categoryIDColumn" Binding="{Binding CategoryID}" Header="Category ID" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="categoryNameColumn" Binding="{Binding CategoryName}" Header="Category Name" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="descriptionColumn" Binding="{Binding Description}" Header="Description" Width="400"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid x:Name="productsDataGrid" Grid.Row="1" AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding Source={StaticResource categoriesProductsViewSource}}" Margin="18,3,21,7" RowDetailsVisibilityMode="VisibleWhenSelected" >
<DataGrid.Columns>
<DataGridTextColumn x:Name="categoryIDColumn1" Binding="{Binding CategoryID}" Header="Category ID" Width="SizeToHeader"/>
<DataGridCheckBoxColumn x:Name="discontinuedColumn" Binding="{Binding Discontinued}" Header="Discontinued" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="productIDColumn" Binding="{Binding ProductID}" Header="Product ID" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="productNameColumn" Binding="{Binding ProductName}" Header="Product Name" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="quantityPerUnitColumn" Binding="{Binding QuantityPerUnit}" Header="Quantity Per Unit" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="reorderLevelColumn" Binding="{Binding ReorderLevel}" Header="Reorder Level" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="supplierIDColumn" Binding="{Binding SupplierID}" Header="Supplier ID" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="unitPriceColumn" Binding="{Binding UnitPrice}" Header="Unit Price" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="unitsInStockColumn" Binding="{Binding UnitsInStock}" Header="Units In Stock" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="unitsOnOrderColumn" Binding="{Binding UnitsOnOrder}" Header="Units On Order" Width="SizeToHeader"/>
</DataGrid.Columns>
</DataGrid>
Это xamdataGrid, который не работает, когда я нажимаю на главную строку:
<igDP:XamDataGrid x:Name="categoriesDataGrid" Grid.Row="0" DataSource="{Binding}" MouseDoubleClick="categoriesDataGrid_MouseDoubleClick">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False"/>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:UnboundField Name="CategoryID" Width="40" Binding="{Binding CategoryID}">
<igDP:Field.Settings>
<igDP:FieldSettings />
</igDP:Field.Settings>
</igDP:UnboundField>
<igDP:Field Name="CategoryID" Width="40" >
<igDP:Field.Settings>
<igDP:FieldSettings />
</igDP:Field.Settings>
</igDP:Field>
<igDP:UnboundField Name="CategoryName" Width="Auto" Binding="{Binding CategoryName}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="Description" Width="Auto" Binding="{Binding Description}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
<igDP:XamDataGrid x:Name="productsDataGrid" Grid.Row="1" DataSource="{Binding Source={StaticResource categoriesProductsViewSource}}">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AutoGenerateFields="False"/>
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:UnboundField Name="CategoryID" Width="40" Binding="{Binding CategoryID}">
<igDP:Field.Settings>
<igDP:FieldSettings />
</igDP:Field.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="Discontinued" Width="Auto" Binding="{Binding Discontinued}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="ProductID" Width="Auto" Binding="{Binding ProductID}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="ProductName" Width="Auto" Binding="{Binding ProductName}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="Quantity Per Unit" Width="Auto" Binding="{Binding QuantityPerUnit}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="Reorder Level" Width="Auto" Binding="{Binding ReorderLevel}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="SupplierID" Width="Auto" Binding="{Binding SupplierID}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="UnitPrice" Width="Auto" Binding="{Binding UnitPrice}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="UnitsInStock" Width="Auto" Binding="{Binding UnitsInStock}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
<igDP:UnboundField Name="UnitsOnOrder" Width="Auto" Binding="{Binding UnitsOnOrder}" >
<igDP:UnboundField.Settings>
<igDP:FieldSettings />
</igDP:UnboundField.Settings>
</igDP:UnboundField>
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>