CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Swiping in C#

Hybrid View

  1. #1
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754

    Swiping in C#

    I'm trying to support a swiping gesture in a Windows Store App written in C# and XAML.

    I've a bunch of objects on a page and I want to know when the person swipes their finger over the objects or runs the mouse over them.

    I can capture the mouse easily enough by checking for the mouse entering the control. What I've not figured out is the event for doing the same with a finger swipe. I was actually surprised that the mouse event wasn't kicked off with a finger swipe.

    Does anyone know the proper event handler for a finger swipe over a control such as a set of buttons?

    Thanks!

  2. #2
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,754

    Re: Swiping in C#

    Here is code that catches the mouse pointer going over a button:

    Code:
            private void btn9999_PointerEntered(object sender, RoutedEventArgs e)
            {
                Button tmp = new Button();
                tmp = (Button)sender;
                tmp.Background = new SolidColorBrush(CurrentColor);
                if (borderson == false)
                {
                    tmp.BorderBrush = tmp.Background;
                }
            }
    That captures the event of the pointer moving over the control. This works for dragging the mouse around the screen. What I'm trying to figure out, however, is how to kick off an event on a touch screen if the finger drags across the same button. Anyone have an idea or do I need to try a few more searches?

    Thanks!

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Swiping in C#

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Swiping in C#

    If I remember correctly, you could use Pointer notifications

    http://msdn.microsoft.com/library/wi...#create_the_ui

    I hope this helps.

  5. #5
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Swiping in C#

    I'm typing this on my phone, so it's kinda ad hoc, and I didn't consult the docs, but I have an idea - might be helpfull. I'm guessing that the problem is that the pointer touches the containing ui element, and then child elements do not get pointer event notifications (similar to how child controls don't get notifications after a mouse down event occurs on the parent, until a mouse up event happens). So, if you can detect a touch, and a release on the container (and maybe also on the first and the last button), you can get two points - a line that describes the swipe (you may need to convert coordinates to parent-space). You can then check if the line intersects an (axis-aligned) bounding rectangle encompassing all the buttons (say, using the separating axis theorem, treating the line segment as an infinitely thin rotated rectangle).
    Last edited by TheGreatCthulhu; May 23rd, 2013 at 05:35 PM.

  6. #6
    Join Date
    May 2013
    Posts
    11

    Post Re: Crystal Report Multi page prob.

    Hi TheGreatCthulhu,

    Thanks for ur advice. But take it clear, m working on Crystal Report 2011. i never using c# and all. So other than that if u have any idea please share .
    Thank you

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Crystal Report Multi page prob.

    Quote Originally Posted by vinothnatarajan View Post
    Hi TheGreatCthulhu,

    Thanks for ur advice. But take it clear, m working on Crystal Report 2011. i never using c# and all. So other than that if u have any idea please share .
    Thank you
    If you have a question, post a new topic, and please don't highjack an existing thread. Thanks.

  8. #8
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Crystal Report Multi page prob.

    Quote Originally Posted by Arjay View Post
    If you have a question, post a new topic, and please don't highjack an existing thread. Thanks.
    Hi Arjay!

    This is the second time he did this in this thread. yesterday he did the same and I eventually moved his post to its own thread here :

    http://forums.codeguru.com/showthrea...37241-Printing

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured