locked
Tapped and DoubleTapped events in same controll RRS feed

  • Question

  • Hello. I need to set 2 events to 1 controll(Grid). This events are tapped and doubletapped. My problem is: when i doubletapped controll, it fire 2 events, tapped and doubletapped. Shouldnt it fire only doubletapped? If its by desing, how can i detect this situation:

     - If user tapped item, AppBar is open with 3 buttons show, edit and delete

     - if user doubletapped, its shortcut for show action

    My problem is: because when i doubletapped, tapped event is fire too, appbar is showing up, second click make appbar dissapear, and doubletappedEvent is not firing at all.

    Thursday, July 19, 2012 2:07 PM

Answers

  • Why dont you show appbar after a short delay link this.

    private void test_Tapped(object sender, TappedRoutedEventArgs e)
            {
                DispatcherTimer timer = new DispatcherTimer();
                //Here it is 200 millisecond, you can check as per your needs.
                timer.Interval = new TimeSpan(0, 0, 0, 0, 200);
                timer.Tick += (src, evt) =>
                {
                    //show appbar
                    timer.Stop();
                };
                timer.Start();
            }

    Also later in double tap event you can stop this timer so that the appbar is not shown.


    - Jegan

    Friday, July 20, 2012 5:41 PM

All replies

  • If doubletapped is not firing, bu tapped is, it sounds like you need to adjust your mouse/touch input settings in the control panel.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    Friday, July 20, 2012 1:53 PM
    Moderator
  • private void test_Tapped(object sender, TappedRoutedEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("Tap");
    }
    private void test_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
    {
        System.Diagnostics.Debug.WriteLine("DoubleTap");
    }

    Let me say it more simple: why i see in console tap and doubletap when i run app and do one doubleclick?

    I say in second part that doubletap not firing, becouse tap event fire and i show appbar in it, this blocks all ui, and second click cant appear. 

    Friday, July 20, 2012 4:38 PM
  • Why dont you show appbar after a short delay link this.

    private void test_Tapped(object sender, TappedRoutedEventArgs e)
            {
                DispatcherTimer timer = new DispatcherTimer();
                //Here it is 200 millisecond, you can check as per your needs.
                timer.Interval = new TimeSpan(0, 0, 0, 0, 200);
                timer.Tick += (src, evt) =>
                {
                    //show appbar
                    timer.Stop();
                };
                timer.Start();
            }

    Also later in double tap event you can stop this timer so that the appbar is not shown.


    - Jegan

    Friday, July 20, 2012 5:41 PM