Beispiel #1
0
        /// <summary>
        /// Raises DismissPopup event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mode"></param>
        public static void RaiseDismissPopupEvent(object sender, DismissPopupMode mode)
        {
            object element = sender;

            /*while (!(element is IDropDownControl))
             * {
             *  object parent = VisualTreeHelper.GetParent(element as DependencyObject);
             *  if (parent is IDropDownControl)
             *  {
             *      element = parent;
             *      break;
             *  }
             *  else if (parent != null) element = parent;
             *  else
             *  {
             *      parent = LogicalTreeHelper.GetParent(element as DependencyObject);
             *      if (parent != null)
             *      {
             *          element = parent;
             *          if (parent is IDropDownControl) break;
             *      }
             *      else break;
             *  }
             * }
             * if (element != null) */(element as UIElement).RaiseEvent(new DismissPopupEventArgs(mode));
        }
Beispiel #2
0
        /// <summary>
        /// Raises DismissPopup event (Async)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mode"></param>
        public static void RaiseDismissPopupEventAsync(object sender, DismissPopupMode mode)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            element.Dispatcher.BeginInvoke((Action)(() => element.RaiseEvent(new DismissPopupEventArgs(mode))));
        }
        /// <summary>
        /// Raises DismissPopup event
        /// </summary>
        public static void RaiseDismissPopupEvent(object sender, DismissPopupMode mode, DismissPopupReason reason = DismissPopupReason.Undefined)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            WriteDebug($"Dismissing Popup (Mode = {mode}, Sender = {sender})");

            element.RaiseEvent(new DismissPopupEventArgs(mode, reason));
        }
        /// <summary>
        /// Raises DismissPopup event (Async)
        /// </summary>
        public static void RaiseDismissPopupEventAsync(object sender, DismissPopupMode mode, DismissPopupReason reason = DismissPopupReason.Undefined)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            WriteDebug($"Dismissing Popup async (Mode = {mode}, Sender = {sender})");

            element.RunInDispatcherAsync(() => RaiseDismissPopupEvent(sender, mode, reason));
        }
        /// <summary>
        /// Raises DismissPopup event (Async)
        /// </summary>
        public static void RaiseDismissPopupEventAsync(object sender, DismissPopupMode mode)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            Debug.WriteLine("Dismissing Popup (async)");

            element.Dispatcher.BeginInvoke((Action)(() => RaiseDismissPopupEvent(sender, mode)));
        }
        /// <summary>
        /// Raises DismissPopup event
        /// </summary>
        public static void RaiseDismissPopupEvent(object sender, DismissPopupMode mode)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            Debug.WriteLine("Dismissing Popup");

            element.RaiseEvent(new DismissPopupEventArgs(mode));
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dismissMode">Dismiss mode.</param>
 /// <param name="reason">Dismiss reason.</param>
 public DismissPopupEventArgs(DismissPopupMode dismissMode, DismissPopupReason reason)
 {
     this.RoutedEvent   = PopupService.DismissPopupEvent;
     this.DismissMode   = dismissMode;
     this.DismissReason = reason;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dismissMode">Dismiss mode.</param>
 public DismissPopupEventArgs(DismissPopupMode dismissMode)
     : this(dismissMode, DismissPopupReason.Undefined)
 {
 }
Beispiel #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dismissMode">Dismiss mode</param>
 public DismissPopupEventArgs(DismissPopupMode dismissMode)
 {
     base.RoutedEvent = PopupService.DismissPopupEvent;
     this.DismissMode = dismissMode;
 }
 /// <summary>
 /// Raises DismissPopup event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="mode"></param>
 public static void RaiseDismissPopupEvent(object sender, DismissPopupMode mode)
 {
     object element = sender;
     /*while (!(element is IDropDownControl))
     {
         object parent = VisualTreeHelper.GetParent(element as DependencyObject);
         if (parent is IDropDownControl)
         {
             element = parent;
             break;
         }
         else if (parent != null) element = parent;
         else
         {
             parent = LogicalTreeHelper.GetParent(element as DependencyObject);
             if (parent != null)
             {
                 element = parent;
                 if (parent is IDropDownControl) break;
             }
             else break;                    
         }
     }
     if (element != null) */(element as UIElement).RaiseEvent(new DismissPopupEventArgs(mode));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dismissMode">Dismiss mode</param>
 public DismissPopupEventArgs(DismissPopupMode dismissMode)
 {
     base.RoutedEvent = PopupService.DismissPopupEvent;
     this.DismissMode = dismissMode;
 }
Beispiel #12
0
        /// <summary>
        /// Raises DismissPopup event (Async)
        /// </summary>
        public static void RaiseDismissPopupEventAsync(object sender, DismissPopupMode mode)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            Debug.WriteLine("Dismissing Popup (async)");

            element.Dispatcher.BeginInvoke((Action)(() => RaiseDismissPopupEvent(sender, mode)));
        }
Beispiel #13
0
        /// <summary>
        /// Raises DismissPopup event
        /// </summary>
        public static void RaiseDismissPopupEvent(object sender, DismissPopupMode mode)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            Debug.WriteLine("Dismissing Popup");

            element.RaiseEvent(new DismissPopupEventArgs(mode));
        }
Beispiel #14
0
        /// <summary>
        /// Raises DismissPopup event (Async)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mode"></param>
        public static void RaiseDismissPopupEventAsync(object sender, DismissPopupMode mode)
        {
            var element = sender as UIElement;

            if (element == null)
            {
                return;
            }

            element.Dispatcher.BeginInvoke((Action)(() => element.RaiseEvent(new DismissPopupEventArgs(mode))));
        }