Exemple #1
0
        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;
            }
        }
Exemple #2
0
        public void RaiseClickEvent(ExecuteRoutedEventArgs e)
        {
            OnPreviewClick(e);

            Dispatcher.BeginInvoke(
                DispatcherPriority.Render,
                (Action <ExecuteRoutedEventArgs>)OnClick,
                e);
        }
Exemple #3
0
        protected virtual void OnClick(ExecuteRoutedEventArgs e)
        {
            e.RoutedEvent = ClickEvent;
            e.Source      = this;

            RaiseEvent(e);

            GameCommand.ExecuteCommandSource(this);
        }
Exemple #4
0
        protected override void OnPreviewClick(ExecuteRoutedEventArgs e)
        {
            var popupAnchor = PopupControlService.GetParentPopupAnchor(this);

            if ((popupAnchor != null) && (popupAnchor.IsPopupOpen && !StaysOpenOnClick))
            {
                PopupControlService.CloseAllPopups(GamePopupCloseReason.ControlClick);
            }

            base.OnPreviewClick(e);
        }
Exemple #5
0
        protected override void OnClick(ExecuteRoutedEventArgs e)
        {
            base.OnClick(e);

            if ((ClickMode == ClickMode.Press) && IsMouseCaptured)
            {
                ReleaseMouseCapture();
            }

            if (!Focusable)
            {
                UpdateCanExecute();
            }
        }
Exemple #6
0
 protected virtual void OnPreviewClick(ExecuteRoutedEventArgs e)
 {
     e.RoutedEvent = PreviewClickEvent;
     e.Source      = this;
     RaiseEvent(e);
 }
Exemple #7
0
 protected override void OnPreviewClick(ExecuteRoutedEventArgs e)
 {
     // Don't raise an event, otherwise ContextMenu parents will close
 }