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

MouseEnter and MouseLeave event triggered when a Button is "Click" by a keyboard key press

$
0
0

Hi, I am writing an application to log user's interaction with WPF controls in VB. I need to record the event MouseEnter, MouseLeave and Click on a WPF Button. However, I noticed that whenever I "Click" the button with a key press from the keyboard such as a space, MouseEnter will be triggered, followed by MouseLeave and then Click. I have simply added the following handles:

    Private Sub RecordInputClick() Handles Me.Click
        RecordInput(ActionType.LeftClick)
    End Sub

    Private Sub RecordInputMouseEnter() Handles Me.MouseEnter
        RecordInput(ActionType.MouseEnter)
    End Sub

    Private Sub RecordInputMouseLeave() Handles Me.MouseLeave
        RecordInput(ActionType.MouseLeave)
    End Sub

Is this normal? Is there a way to not detect the "extra" MouseEnter and MouseLeave?

Thank you.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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