Accessing XAML background events

Jul 14, 2010 at 12:32 AM

Is there a way to access a XAML background to trigger mouse events without setting IsHitTestVisible = "False" on myGame (see below)?  Can Canvas use the new Balder mouse events?

 

<Canvas x:Name="background" ><Ellipse /></Canvas>

 <Execution:Game Name="myGame" Width="1366" Height="768">

<Geometries:Mesh x:Name="_ship" AssetName="Ship.ase" IsHitTestVisible="False" MouseLeftButtonDown="_ship_MouseLeftButtonDown" />

 </Execution:Game>

 

Also, in the above example, if IsHitTestVisible = "False" for _ship, but IsHitTestVisible = "True" for myGame, _ship mouse events are still triggered when clicking on _ship.  Of course turning  IsHitTestVisible = "False" for myGame

allows me to access the canvas "background", but this means that I can't click on _ship.  I expected the latter, but not the former.

Thanks

Coordinator
Jul 14, 2010 at 8:05 AM

Balder is not respecting the IsHitTestVisible - inside the Game, which is in fact just a grid, there is a WriteableBitmap, and its the one getting all the mouse events. The mouse events are then translated into Balder specifics. 

Looking at your Xaml, you might be able to achieve events on your Canvas if you put the Game inside it, as the mouse events should then be routed from the WriteableBitmap to the Game and then to the Canvas.