我想在 Datagridcell 文本更改时放置一个列表视图。我的数据网格有一个列,即产品,当用户在该列上键入内容时,会弹出一个带有产品的小列表视图,因此用户可以从列表视图中选择一个产品,并且产品显示在datagrid 的 Product 列。我的问题是我无法将 Listview 放置在我编辑的单元格附近。
我的 XAML 是:
<!--My datagrid-->
<my:DataGrid Name="dgvSales" BeginningEdit="dgvSales_BeginningEdit" VirtualizingStackPanel.IsVirtualizing="False" AutoGenerateColumns="False" Margin="13,150,9,117" KeyDown="dgvSales_KeyDown" MouseDown="dgvSales_MouseDown" PreparingCellForEdit="dgvSales_PreparingCellForEdit" >
<my:DataGrid.Columns>
<my:DataGridTextColumn x:Name="naam" Header="Code" Width="120" Binding="{Binding ProductCode}"></my:DataGridTextColumn>
<my:DataGridTextColumn Header="Product Name" Width="200" Binding="{Binding ProductName}"></my:DataGridTextColumn>
<my:DataGridComboBoxColumn Header="Unit" Width="100"></my:DataGridComboBoxColumn>
<my:DataGridTextColumn Header="Purchase Rate" Width="100" Binding="{Binding PurchaseRate}"></my:DataGridTextColumn>
<my:DataGridTextColumn Header="Qty" Width="100" Binding="{Binding Qty}"></my:DataGridTextColumn>
<my:DataGridTextColumn Header="Amount" Width="100" Binding="{Binding Amount}"></my:DataGridTextColumn>
</my:DataGrid.Columns>
</my:DataGrid>
<!--My listview-->
<ListView Height="161" ItemsSource="{Binding}" Name="lstvwProductCode" VerticalAlignment="Bottom" Width="388">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Path=Record_Id}" Header="Record ID" Width="0" />
<GridViewColumn DisplayMemberBinding="{Binding Path=Product_Code}" Header="Pcode" Width="110" />
<GridViewColumn DisplayMemberBinding="{Binding Path=Product_Name}" Header="Product" Width="180" />
</GridView>
</ListView.View>
</ListView>