public override void ClosePopup()
 {
     if (Closing != null)
     {
         CommandManager.InvalidateRequerySuggested();
         bool IsClosingCanceled = false;
         var closed = new RibbonMenuCloseingEventArgs(() => IsClosingCanceled = true);
         Closing(this, closed);
         if (IsClosingCanceled)
             return;
     }
     base.ClosePopup();
 }
 private void ApplicationMenuOnClosing(object sender,
                                       RibbonMenuCloseingEventArgs ribbonMenuCloseingEventArgs)
 {
     if (OnButtonClicked)
         ribbonMenuCloseingEventArgs.CancelClose = false;
 }