Note that there are some explanatory texts on larger screens.

plurals
  1. POIsMouseOver not triggering
    text
    copied!<p>This question is related to <a href="https://stackoverflow.com/questions/18472697/how-to-apply-style-if-class-variable-is-true">another question</a> that I just barely asked on SO as well.</p> <p>I have a Canvas with both a Path and a TextBlock in it.</p> <pre><code>&lt;Canvas&gt; &lt;Path Name="pathNodeType" StrokeThickness="1"&gt; &lt;Path.Style&gt; &lt;Style&gt; &lt;Setter Property="Path.Stroke" Value="Black" /&gt; &lt;Setter Property="Path.Fill" Value="LightGray" /&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="Canvas.IsMouseOver" Value="True"&gt; &lt;Setter Property="Path.Stroke" Value="Blue" /&gt; &lt;Setter Property="Path.Fill" Value="LightBlue" /&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/Path.Style&gt; &lt;Path.Data&gt; &lt;PathGeometry&gt; &lt;PathGeometry.Figures&gt; &lt;PathFigureCollection&gt; &lt;PathFigure IsClosed="True" StartPoint="20,40"&gt; &lt;PathFigure.Segments&gt; &lt;PathSegmentCollection&gt; &lt;ArcSegment Size="10,10" RotationAngle="45" IsLargeArc="True" SweepDirection="Clockwise" Point="50,40" /&gt; &lt;LineSegment Point="50,60" /&gt; &lt;LineSegment Point="20,60" /&gt; &lt;/PathSegmentCollection&gt; &lt;/PathFigure.Segments&gt; &lt;/PathFigure&gt; &lt;/PathFigureCollection&gt; &lt;/PathGeometry.Figures&gt; &lt;/PathGeometry&gt; &lt;/Path.Data&gt; &lt;/Path&gt; &lt;TextBlock HorizontalAlignment="Left" Margin="22,40,0,0" TextWrapping="Wrap" Text="AND" VerticalAlignment="Top" FontWeight="Bold"/&gt; &lt;/Canvas&gt; </code></pre> <p>The IsMouseOver property of the canvas triggers the path style as I expect it to when the mouse pointer is over the drawn path. However, when the mouse pointer is over the textblock (which is positioned right smack in the middle of the drawn path) then the path style does not trigger as I expect it to. </p> <p>Why does it not trigger? The textblock resides within the canvas, so technically speaking isn't the mouse pointer over the canvas as well?</p> <p>Thanks in advance for any help on this.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload