この質問は、SOでもかろうじて尋ねた別の質問に関連しています。
Path と TextBlock の両方を含む Canvas があります。
<Canvas>
<Path Name="pathNodeType" StrokeThickness="1">
<Path.Style>
<Style>
<Setter Property="Path.Stroke" Value="Black" />
<Setter Property="Path.Fill" Value="LightGray" />
<Style.Triggers>
<Trigger Property="Canvas.IsMouseOver" Value="True">
<Setter Property="Path.Stroke" Value="Blue" />
<Setter Property="Path.Fill" Value="LightBlue" />
</Trigger>
</Style.Triggers>
</Style>
</Path.Style>
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure IsClosed="True" StartPoint="20,40">
<PathFigure.Segments>
<PathSegmentCollection>
<ArcSegment Size="10,10" RotationAngle="45" IsLargeArc="True" SweepDirection="Clockwise" Point="50,40" />
<LineSegment Point="50,60" />
<LineSegment Point="20,60" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<TextBlock HorizontalAlignment="Left" Margin="22,40,0,0" TextWrapping="Wrap" Text="AND" VerticalAlignment="Top" FontWeight="Bold"/>
</Canvas>
キャンバスの IsMouseOver プロパティは、マウス ポインターが描画されたパス上にあるときに期待どおりにパス スタイルをトリガーします。ただし、マウスポインターがテキストブロック (描画されたパスの真ん中に配置されている) の上にある場合、期待どおりにパススタイルがトリガーされません。
トリガーされないのはなぜですか?テキストブロックはキャンバス内にあるので、技術的に言えば、マウス ポインターもキャンバス上にあるのではないでしょうか。
これについて何か助けてくれてありがとう。