Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8143051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:59:29+00:00 2026-06-06T12:59:29+00:00

I have developed a C# app that overrides the PreviewMouseUp, PreviewMouseMove, and PreviewMouseDown events

  • 0

I have developed a C# app that overrides the PreviewMouseUp, PreviewMouseMove, and PreviewMouseDown events in some custom controls to allow scrolling a scroll viewer by clicking and dragging. This custom code works great on non-touch screens when the mouse is used to drag and scroll, but when I use it on a real touch screen monitor it fails to work because the PreviewMouseUp does not get fired when the monitor is touched and dragged with a finger.

I want to be able to use my existing code with minimal changes. This would allow me to use the mouse to click/drag while debugging on my laptop, and use the touch screen to touch/drag.

Is there anyway to configure a windows 7 computer to treat all touches (PreviewTouchUp, PreviewTouchDown, and PreviewTouchMove) as mouse events instead?

UPDATE: I forgot to mention. I thought that if the Touch events are not handled, than .NET automatically raises the Mouse events afterwards. This does not appear to be happening even though none of the code I wrote handles the Touch Events currently. Any ideas why this may be happening?

Thanks,
brian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:59:32+00:00Added an answer on June 6, 2026 at 12:59 pm

    What you can do is to use the same method for both, something like this:

    protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
    {
        OnPreviewTouchMouseUp(e);
    }
    
    protected override void OnPreviewTouchUp(TouchEventArgs e)
    {
        OnPreviewTouchMouseUp(e);
    }
    
    private void OnPreviewTouchMouseUp(EventArgs e)
    {
    
    }
    

    The only difference will be the way you get the coordinates of the mouse/touch:

    For touch:

    e.GetTouchPoint(this).Position;
    

    For mouse:

    e.GetPosition(this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an app that in testing has worked fine but when it
I have a nice clean domain layer in my app that was developed in
I have developed an android app that mainly targets smartphones. However in tablet emulator
I have developed an app that allows the user to fill out text fields
I have developed an App that target version is 4 (Android 1.6) upto 7
I have developed a simple app that contains a UITableView that displays data, and
I have developed an android app that automatically sends an SMS automatically to a
I have developed a small app that stores locally in iOS through archiving an
I have a web app that runs fine in Visual web developer. But when
http://developer.android.com/tools/publishing/app-signing.html I have a keystore that I already have an alias and password for.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.