Forget about "just haml". This can be easily solved when you wrap it in the attached behavior.
The following is a way to display the context menu by left-clicking:
Create a new left button handler in the Border element:
<Border x:Name="Win" Width="40" Height="40" Background="Purple" MouseLeftButtonUp="UIElement_OnMouseLeftButtonUp">
and then add the following:
private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { e.Handled = true; var mouseDownEvent = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Right) { RoutedEvent = Mouse.MouseUpEvent, Source = Win, }; InputManager.Current.ProcessInput(mouseDownEvent); }
What he does, he basically displays the left click with the right mouse button. For reuse, you can wrap this in the attached behavior.
Erti-Chris Eelmaa
source share