protected override void OnClick(ExecuteRoutedEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } // Ignore the base code so that a command is not raised if (IsPopupOpen) { // Only close the popup if not a menu item if (Context != GameControlContext.MenuItem) { IsPopupOpen = false; } } else { // Fire the command GameCommand.ExecuteCommandSource(this); // Flag if the popup is being opened with the mouse ((IGamePopupAnchor)this).PopupOpenedWithMouse = (e.Reason == ExecuteReason.Mouse); // Open the popup IsPopupOpen = true; } }
public void RaiseClickEvent(ExecuteRoutedEventArgs e) { OnPreviewClick(e); Dispatcher.BeginInvoke( DispatcherPriority.Render, (Action <ExecuteRoutedEventArgs>)OnClick, e); }
protected virtual void OnClick(ExecuteRoutedEventArgs e) { e.RoutedEvent = ClickEvent; e.Source = this; RaiseEvent(e); GameCommand.ExecuteCommandSource(this); }
protected override void OnPreviewClick(ExecuteRoutedEventArgs e) { var popupAnchor = PopupControlService.GetParentPopupAnchor(this); if ((popupAnchor != null) && (popupAnchor.IsPopupOpen && !StaysOpenOnClick)) { PopupControlService.CloseAllPopups(GamePopupCloseReason.ControlClick); } base.OnPreviewClick(e); }
protected override void OnClick(ExecuteRoutedEventArgs e) { base.OnClick(e); if ((ClickMode == ClickMode.Press) && IsMouseCaptured) { ReleaseMouseCapture(); } if (!Focusable) { UpdateCanExecute(); } }
protected virtual void OnPreviewClick(ExecuteRoutedEventArgs e) { e.RoutedEvent = PreviewClickEvent; e.Source = this; RaiseEvent(e); }
protected override void OnPreviewClick(ExecuteRoutedEventArgs e) { // Don't raise an event, otherwise ContextMenu parents will close }