I have this app:
<App>
<Panel X="40%" Y="40%" Width="20%" Height="20%" Background="#0f0" ux:Name="pan" HitTestMode="LocalBoundsAndChildren">
<Panel X="-100%" Y="-100%" Width="300%" Height="300%" />
<WhilePressed>
<Change pan.Color="#000" />
</WhilePressed>
</Panel>
</App>
And it works if you add Background="#0000"
to the child Panel
. I thought that LocalBoundsAndChildren
should give the bounds, even though the child has no visual.
I don’t think there is an issue here. The HitTestMode
is working as intended. Perhaps you expected the LocalBounds
to extend to the children, but it does not. If you want the invisible child to detect hits you must put HitTestMode="LocalBounds"
on it as well. LocalBounds
only ever refers to the “local” bounds: the size of the element.
Also note, you should not combine Background
with Color
on a panel since Color
is really a shortcut to the Background
. The above won’t animate correctly if you reference it two different ways.