Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

Your Answer


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.