Button hover effect and touch (WPF) Button hover effect and touch (WPF) wpf wpf

Button hover effect and touch (WPF)


I was able to fix that by using following behavior which uses visual states:

public class TouchDeviceMouseOverUIElementFixBehavior : Behavior<UIElement>{    protected override void OnAttached()    {        AssociatedObject.StylusUp += AssociatedObject_StylusUp;    }    protected override void OnDetaching()    {        AssociatedObject.StylusUp -= AssociatedObject_StylusUp;    }    private void AssociatedObject_StylusUp(object sender, StylusEventArgs e)    {        var control = sender as FrameworkElement;        if (control != null)        {            if (!VisualStateManager.GoToElementState(control, "Normal", true))            {                VisualStateManager.GoToState(control, "Normal", true);            }        }    }}


You can do this by removing default mouse hover option in WPF. It worked perfectly fine for me.

Here is the source i found the answer