C# WPF中形状上的鼠标事件
我正在从事类似的项目:。 我将连接绑定到Arrow类,该类通过以下方式派生形状: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
<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
可以用作用户交互方面的任何控件。