我有一个DataGrid
并且我想在双击该行时显示另一个表单,但是即使我正在滚动数据网格,这个事件也会触发。仅在双击该行时如何使其触发?
我正在使用 MVVM 模式。
<DataGrid Name="dgScopeRecords" Grid.Row="1" Grid.ColumnSpan="3" IsReadOnly="True" ItemsSource="{Binding Model.TableScopeRecords}" SelectedIndex="{Binding Model.SelectedIndex}" Margin="0,10,0,0" AutoGenerateColumns="False" SelectionMode="Single">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding ViewScopeRecordCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#dca188"/>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static Resources:Translations.RecordsInspection_ColumnScope}" Binding="{Binding Scope.ScopeName}" Width="250"/>
<DataGridTextColumn Header="{x:Static Resources:Translations.RecordsInspection_ColumnScopeType}" Binding="{Binding Scope.ScopeType.ScopeTypeName}" Width="100"/>
</DataGrid.Columns>
</DataGrid>