1 回答
TA贡献1887条经验 获得超5个赞
您可以处理MouseLeftButtonDown并检查ClickCount外部DataGrid:
private void dgFiles_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
System.Diagnostics.Debug.WriteLine("dgFiles_MouseDoubleClick(object sender, MouseButtonEventArgs e)");
}
}
private void dgLines_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
System.Diagnostics.Debug.WriteLine("dgLines_MouseDoubleClick(object sender, MouseButtonEventArgs e)");
e.Handled = true;
}
XAML:
<Window.Resources>
<DataTemplate x:Key="LinesGrid">
<DataGrid x:Name="dgLines"
ItemsSource="{Binding Path=Lines}"
AutoGenerateColumns="True"
IsReadOnly="True"
MouseDoubleClick="dgLines_MouseDoubleClick">
</DataGrid>
</DataTemplate>
</Window.Resources>
<Grid>
<DataGrid x:Name="dgFiles"
ItemsSource="{Binding}"
AutoGenerateColumns="True"
IsReadOnly="True"
RowDetailsVisibilityMode="VisibleWhenSelected"
RowDetailsTemplate="{StaticResource LinesGrid}"
MouseLeftButtonDown="dgFiles_MouseDoubleClick">
</DataGrid>
</Grid>
- 1 回答
- 0 关注
- 73 浏览
添加回答
举报