Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a game with Silverlight / XNA game where text and buttons are created in Silverlight while 3d is done in XNA.

The Silverlight controls are drawn ontop of the 3D and I dont want a click on a button to interact with the 3D underneath

So I have

private void ButtonPlaceBrick_Tap(object sender, GestureEventArgs e)
{
    e.Handled = true;

But my gesture handling on the 3d objects still runs even though I have set handled to true.

private void OnUpdate(object sender, GameTimerEventArgs e)
{
    while (TouchPanel.IsGestureAvailable)
    {
         // Read the next gesture
         GestureSample gesture = TouchPanel.ReadGesture();
         switch (gesture.GestureType)

How am I supposed to stop it from propagating?

share|improve this question
add comment

1 Answer

The best solution is to define a region that contains your controls and if the touch position is inside it, do nothing in your XNA code since the event is already processed by Silverlight controls.

share|improve this answer
    
Is there an easy way to get the area button takes up on the screen? –  Mech0z Apr 9 '12 at 11:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.