Mouse extra buttons in WPF
mouseevent, wpf
Solution
In the constructor:
MouseDown += MouseDownEvent;
The event handler:
private void MouseDownEvent(object sender, MouseButtonEventArgs e)
{
switch (e.ChangedButton)
{
case MouseButton.XButton1://Back button
MessageBox.Show("Back button pressed");
break;
case MouseButton.XButton2://forward button
MessageBox.Show("Forward button pressed");
break;
default:
break;
}
}
Problem
Is it possible to capture clicks from the extra buttons of a mouse in WPF? I want to implement back and forward navigation using the mouse in my application like when you browse the Internet. When an extra button is clicked I want to execute a command. I have only managed to find examples where the left/right/wheel buttons are used. Thanks in advance.