Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF中形状上的鼠标事件_C#_Wpf_Wpf Controls - Fatal编程技术网

C# WPF中形状上的鼠标事件

C# WPF中形状上的鼠标事件,c#,wpf,wpf-controls,C#,Wpf,Wpf Controls,我正在从事类似的项目:。 我将连接绑定到Arrow类,该类通过以下方式派生形状: <DataTemplate DataType="{x:Type local:ConnectionViewModel}"> <local:Arrow Stroke="Black" StrokeThickness="5" Fill="Black" Start="{Binding SourceConnectorHotspot}" End="{Binding DestConnectorHotspot

我正在从事类似的项目:。 我将连接绑定到Arrow类,该类通过以下方式派生形状:

 <DataTemplate DataType="{x:Type local:ConnectionViewModel}">
  <local:Arrow Stroke="Black" StrokeThickness="5" Fill="Black" Start="{Binding SourceConnectorHotspot}" End="{Binding DestConnectorHotspot}" IsHitTestVisible="False" MouseEnter="Arrow_MouseEnter"  MouseDown="Arrow_MouseDown"/>
 </DataTemplate>


有没有办法将双击事件或任何与鼠标相关的事件添加到该箭头中?

我简直不敢相信。我浪费了这么多时间,在发帖15分钟后找到了答案。我复制了上面的代码。事实证明,这行代码:

IsHitTestVisible="False"

“转折”事件

Shape
源于
FrameworkElement
,它也源于
UIElement
UIElement
支持许多交互事件,因此
Shape
可以用作用户交互方面的任何控件。