我有 2 个数据网格单击我在其他数据网格中添加项目但是当我单击滚动条拇指或轴多次滚动它时在其他数据网格上添加项目请帮助我
这是代码
<DataGrid Name="dgMenu" Grid.Row="1" Grid.RowSpan="4" Margin="5,0,0,0" AutoGenerateColumns="False" RowHeight="25" AlternatingRowBackground="{StaticResource AlternateRowBackgroundBrush}" IsReadOnly="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
HeadersVisibility="Column" SelectionUnit="FullRow" ItemsSource="{Binding DgMenuCollection,Mode=TwoWay}" SelectedItem="{Binding DgSelectedMenu,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" PreviewKeyUp="dgMenu_PreviewKeyUp"
VerticalGridLinesBrush="{StaticResource GridLineColorBrush}" HorizontalGridLinesBrush="{StaticResource GridLineColorBrush}" Grid.Column="0" Grid.ColumnSpan="2" MouseDoubleClick="dgMenu_MouseDoubleClick">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<Trigger Property="DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource ButtonSelectedBrush}" />
<Setter Property="BorderBrush" Value="#A8E3FC" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="Code" Binding="{Binding PN_Recipe.RecipeCode}" />
<DataGridTextColumn Header="Recipe Name" Binding="{Binding PN_Recipe.RecipeName}"/>
<DataGridTextColumn Header="RecipeHalf Price" Binding="{Binding HalfMenuCost}" Visibility="Collapsed" />
<DataGridTextColumn Header="MenuFull Price" Binding="{Binding FullMenuCost}" Visibility="Collapsed"/>
</DataGrid.Columns>
</DataGrid>