private void OnRightClick(Point cp) { var rightClick = this.RightClick; if (rightClick != null) { var mce = new MouseRightClickEventArgs(cp); rightClick(this, mce); } }
static void Instance_RightClick(object sender, MouseRightClickEventArgs e) { foreach (UIElement element in e.GetElementsInPosition(Application.Current.RootVisual)) { var getMenu = GetContextMenu(element); if (getMenu == null) { continue; } HideCurrentMenu(); var menu = getMenu(e.Position); if (menu != null) { m_CurrentMenu = menu; menu.LayoutUpdated += menu_LayoutUpdated; menu.SetLocation(e.Position); menu.IsDropDownOpen = true; } break; } }
static void Instance_RightClick(object sender, MouseRightClickEventArgs e) { foreach (UIElement element in e.GetElementsInPosition(Application.Current.RootVisual)) { var getMenu = GetContextMenu(element); if (getMenu == null) continue; HideCurrentMenu(); var menu = getMenu(e.Position); if (menu != null) { m_CurrentMenu = menu; menu.LayoutUpdated += menu_LayoutUpdated; menu.SetLocation(e.Position); menu.IsDropDownOpen = true; } break; } }