Results 1 to 1 of 1

Thread: Mouse Events missing fire

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2015
    Posts
    174

    Mouse Events missing fire

    I'm new in wpf, I need to recreate the behavior of an old winform drawing app.
    In the winform app I used this event
    MouseMove
    MouseClick
    MouseDown
    MouseUp
    Basically there are 2 main behavior: single click managed from MouseClick(that contains drawing logic) and "press and move" managed by MouseDown (set a flag) MouseUp(clear a falg) and Mouse Move(that contains the drawing logic).

    In saw that in WPF there are some changes so after few test I used on the canvas:
    PreviewMouseDown to set the flag,
    PreviewMouseMove as MouseMove in winform,
    PreviewMouseUp to clear the flag and to handle the "sigle click".
    So, I did not like too much to drawing with the PreviewMouseUp because for user experience seem lagging, but this is not the main problem:
    I checked in debug(also putting a System.Diagnostics.Debug.WriteLine("...") in the mouses event), and I have several missing fire for both PreviewMouseDown and PreviewMouseUp; I did not found any logic in this behavior,as first I would say they are random, but then I realize that I've this missing event when I click on other shapes drawed on the canvas (rectangles for example).
    I've to say also that the canvas is inside an usercontrol, and that the PreviewMouseMove work correctly.
    I've find the msdn page about it but I've not fully understand it. anyone have experiece similar iusses? Is my approach wrong?
    I'm building a minimal example that I'll post soon if needed.
    Last edited by hannibal smith; Oct 7th, 2021 at 05:00 AM.

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