У меня есть событие MouseDoubleClick в следующем файле .xaml, который не срабатывает должным образом:
<Style TargetType="controls:Source" x:Key="{x:Type controls:Source}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Source">
<Border BorderThickness="0.8" CornerRadius="10" BorderBrush="{TemplateBinding Foreground}"
d:DataContext="{d:DesignInstance d:Type=viewModels:SourceViewModel}">
<Grid Style="{StaticResource ElementThatClipsToParentBordersStyle}">
<Image Source="{Binding AttachedSource.Image, RelativeSource={RelativeSource TemplatedParent}}" Stretch="Fill" />
<Border x:Name="Selection"
Opacity="0.3"
Background="{TemplateBinding Foreground}"
Visibility="Collapsed"
IsHitTestVisible="False"/>
</Grid>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<interactivity:InvokeCommandAction Command="{Binding DataContext.SelectionState.ClickSourceCommand, ElementName=SourcesControl}"
CommandParameter="{Binding}" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewMouseLeftButtonDown">
<interactivity:InvokeCommandAction Command="{Binding PreviewLeftClickCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseMove">
<interactivity:InvokeCommandAction Command="{Binding MouseMoveCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseDoubleClick">
<interactivity:InvokeCommandAction Command="{Binding SourceDoubleClickCommand}"
CommandParameter="{Binding}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Selection" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
Любое другое событие работает нормально и по назначению, но команда, связанная с событием MouseDoubleClick, не выполняется.
Странно то, что когда я использую другое событие, такое как MouseLeftButtonDown, все работает, поэтому проблема, похоже, связана не с выполненной командой, а с самим используемым событием.
Конечно, я мог бы обойти эту проблему, используя простое событие MouseLeftButtonDown и проверяя время последнего щелчка, чтобы идентифицировать двойной щелчок, но встроенное событие двойного щелчка кажется мне лучшим способом.
Кто-нибудь знает, почему событие MouseDoubleClick не срабатывает должным образом в этом сценарии?