Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF firing MouseDown events from incorrect locations when using touchscreen in .NET after 4.5.0

$
0
0

So through 4.5.0 we just let .NET touch events trickle down to regular mouse events and everything is fine.  But, .NET 4.5.1 changed something and broke this for us.

I have a datagrid, and there is no click event for WPF datagrid.  So we are using the mousedown event.  The event handler essentially does this right now:

        private void myDataGrid_MouseDown(object sender, System.Windows.Input.MouseEventArgs e)
        {
            MessageBox.Show("Stylus: " + e.StylusDevice.GetPosition(myDataGrid));
        }

The first event is fine.  Then when I touch anywhere else on the screen, the event handler still fires.  Even though the pop-up shows negative values, meaning that the event is clearly happening outside of the datagrid.

MouseDownEvent Description From MSDN: "Occurs when any mouse button is pressed while the pointer is over this element."  Clearly this is not being fulfilled by my described behavior.

Now I do have a workaround that will totally work.  But I don't want to hack my code up to support a bug in the framework.  If I explicitly handle TouchDown, StylusDown and MouseDown, the problem totally goes away.




Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>