我有一個DataGrid
,我想展現另一種形式當行被雙擊,但這一事件被射擊即使我滾動數據網格。只有當該行被雙擊時如何才能讓它啓動?滾動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>
看看這個問題:http://stackoverflow.com/questions/6123748/show-rowdetails-on-double-click-in-wpf-datagrid – Vladimir