Esempio n. 1
0
        private static void DoubleClickCommand_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UIElement target = d as UIElement;

            if (e.OldValue != null)
            {
                target?.RemoveHandler(ListBox.MouseDoubleClickEvent, new RoutedEventHandler(ListBox_DoubleClick));
            }

            if (e.NewValue != null)
            {
                target?.AddHandler(ListBox.MouseDoubleClickEvent, new RoutedEventHandler(ListBox_DoubleClick));
            }
        }
Esempio n. 2
0
		public static void AddPreviewExecutedHandler (UIElement element, ExecutedRoutedEventHandler handler)
		{
			if (element == null) throw new ArgumentNullException ("element");
			if (handler == null) throw new ArgumentNullException ("handler");
			element.AddHandler (PreviewExecutedEvent, handler);
		}
Esempio n. 3
0
 /// <summary>
 ///     Adds a handler for the PreviewGotKeyboardFocus attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddPreviewGotKeyboardFocusHandler(DependencyObject element, KeyboardFocusChangedEventHandler handler)
 {
     UIElement.AddHandler(element, PreviewGotKeyboardFocusEvent, handler);
 }
Esempio n. 4
0
 public static void AddUnselectedHandler(this UIElement element, SelectorEventHandler handler)
 {
     element.AddHandler(UnselectedEvent, handler);
 }
Esempio n. 5
0
 public static void HookAcquireFocus(UIElement element)
 {
     element.AddHandler(AcquireFocusEvent, new RoutedEventHandler(SetFocus));
 }
Esempio n. 6
0
 /// <summary>
 ///     Adds a handler for the PreviewStylusUp attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddPreviewStylusUpHandler(DependencyObject element, StylusEventHandler handler)
 {
     UIElement.AddHandler(element, PreviewStylusUpEvent, handler);
 }
Esempio n. 7
0
 /// <summary>
 ///     Adds a handler for the StylusButtonUp attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddStylusButtonUpHandler(DependencyObject element, StylusButtonEventHandler handler)
 {
     UIElement.AddHandler(element, StylusButtonUpEvent, handler);
 }
Esempio n. 8
0
 /// <summary>
 ///     Adds a handler for the StylusSystemGesture attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddStylusSystemGestureHandler(DependencyObject element, StylusSystemGestureEventHandler handler)
 {
     UIElement.AddHandler(element, StylusSystemGestureEvent, handler);
 }
Esempio n. 9
0
 public static void AddErrorHandler(UIElement element, RoutedEventHandler handler)
 {
     element.AddHandler(ErrorEvent, handler);
 }
Esempio n. 10
0
        private void SearchBoxParent_Loaded(object sender, RoutedEventArgs e)
        {
            UIElement parent = (UIElement)sender;

            parent.AddHandler(KeyDownEvent, (KeyEventHandler)HandleListBoxNavigationKeys, true);
        }
Esempio n. 11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.button   = (ToggleButton)this.GetTemplateChild("PART_ToggleDropDown");
            this.popup    = (Popup)this.GetTemplateChild("PART_Popup");
            this.content  = (ContentControl)this.GetTemplateChild("PART_Content");
            this.dragGrip = (FrameworkElement)this.GetTemplateChild("PART_DragGrip");

            if (this.popup != null)
            {
                this.popup.Opened += (sender, args) =>
                {
                    if (this.PopupOpened != null)
                    {
                        this.PopupOpened(sender, args);
                    }
                };
            }

            if (this.content != null)
            {
                this.content.LayoutUpdated += (sender, args) =>
                {
                    if (this.ContentLayoutUpdated != null)
                    {
                        this.ContentLayoutUpdated(this.content, args);
                    }
                };
            }

            this.SizeChanged += this.DropDownButton_SizeChanged;
            if (this.dragGrip != null)
            {
                this.dragGrip.MouseLeftButtonDown += this.dragGrip_MouseLeftButtonDown;
                this.dragGrip.MouseMove           += this.dragGrip_MouseMove;
                this.dragGrip.MouseLeftButtonUp   += this.dragGrip_MouseLeftButtonUp;
            }

#if (SILVERLIGHT)
            UIElement root = Application.Current.RootVisual;
            if (root != null)
            {
                root.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(this.OnRootMouseLeftButtonDown), true);
            }
#endif

#if (!SILVERLIGHT)
            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                System.Windows.Window window = System.Windows.Window.GetWindow(this);
                window.LocationChanged += window_LocationChanged;
                window.SizeChanged     += window_SizeChanged;
                window.Deactivated     += window_Deactivated;
                window.Activated       += window_Activated;
                LayoutUpdated          += DropDownButton_LayoutUpdated;
            }

            popup.Opened += popup_Opened;
            Window.GetWindow(this).AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(Outside_MouseDown), true);
            Window.GetWindow(this).Activated += window_Activated;
#endif
        }
Esempio n. 12
0
 internal static void UpdateHandler(this UIElement element, RoutedEvent routedEvent, Delegate handler)
 {
     element.RemoveHandler(routedEvent, handler);
     element.AddHandler(routedEvent, handler);
 }
Esempio n. 13
0
 public static void AddLastPageHandler(UIElement e, RoutedEventHandler handler)
 {
     e.AddHandler(LastPageEvent, handler);
 }
Esempio n. 14
0
 public static void AddContentChangedHandler(UIElement el, RoutedEventHandler handler)
 {
     el.AddHandler(ContentChangedEvent, handler);
 }
Esempio n. 15
0
 /// <summary>
 /// Adds an event handler for the Moved event.
 /// </summary>
 /// <param name="obj">The target element.</param>
 /// <param name="handler">The event handler.</param>
 public static void AddMovedHandler(UIElement obj, EventHandler<DragMoverMovedEventArgs> handler)
 {
     obj.AddHandler(MovedEvent, handler);
 }
Esempio n. 16
0
 /// <summary>
 /// Adds an event handler for the PreviewMoving event.
 /// </summary>
 /// <param name="obj">The target element.</param>
 /// <param name="handler">The event handler.</param>
 public static void AddPreviewMovingHandler(UIElement obj, EventHandler<DragMoverMovingEventArgs> handler)
 {
     obj.AddHandler(PreviewMovingEvent, handler);
 }
Esempio n. 17
0
 /// <summary>
 ///     Adds a handler for the StylusOutOfRange attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddStylusOutOfRangeHandler(DependencyObject element, StylusEventHandler handler)
 {
     UIElement.AddHandler(element, StylusOutOfRangeEvent, handler);
 }
Esempio n. 18
0
 public static void AddValidationDirtyHandler(this UIElement o, RoutedEventHandler handler)
 {
     o.AddHandler(ValidationDirtyEvent, handler);
 }
Esempio n. 19
0
 /// <summary>
 ///     Adds a handler for the LostStylusCapture attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddLostStylusCaptureHandler(DependencyObject element, StylusEventHandler handler)
 {
     UIElement.AddHandler(element, LostStylusCaptureEvent, handler);
 }
Esempio n. 20
0
 /// <summary>
 ///     Adds a handler for the LostFocus attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddLostFocusHandler(DependencyObject element, RoutedEventHandler handler)
 {
     UIElement.AddHandler(element, LostFocusEvent, handler);
 }
Esempio n. 21
0
 /// <summary>
 ///     Adds a handler for the PreviewStylusButtonDown attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddPreviewStylusButtonDownHandler(DependencyObject element, StylusButtonEventHandler handler)
 {
     UIElement.AddHandler(element, PreviewStylusButtonDownEvent, handler);
 }
Esempio n. 22
0
 public static void AddTappedHandler(UIElement element, TappedEventHandler handler)
 {
     element.AddHandler(TappedEvent, handler);
 }
Esempio n. 23
0
 internal static void AddHandlerInt(this UIElement uie, RoutedEvent routedEvent, Delegate handler, bool handledEventsToo)
 {
     uie.AddHandler(routedEvent, handler, handledEventsToo);
 }
Esempio n. 24
0
 public static void AddDragEndHandler(this UIElement element, DragRoutedEventHandler handler)
 {
     element.AddHandler(DragEndEvent, handler);
 }
 public HexMouseProcessorCollection(UIElement mouseElement, UIElement manipulationElement, DefaultHexMouseProcessor defaultMouseProcessor, HexMouseProcessor[] mouseProcessors, Func <MouseEventArgs, bool> allowEvent)
 {
     if (mouseElement == null)
     {
         throw new ArgumentNullException(nameof(mouseElement));
     }
     if (defaultMouseProcessor == null)
     {
         throw new ArgumentNullException(nameof(defaultMouseProcessor));
     }
     if (mouseProcessors == null)
     {
         throw new ArgumentNullException(nameof(mouseProcessors));
     }
     this.mouseElement          = mouseElement;
     this.manipulationElement   = manipulationElement;
     this.defaultMouseProcessor = defaultMouseProcessor;
     this.mouseProcessors       = mouseProcessors;
     this.allowEvent            = allowEvent ?? defaultAllowEvent;
     mouseElement.AddHandler(UIElement.QueryContinueDragEvent, new QueryContinueDragEventHandler(MouseElement_QueryContinueDrag), true);
     mouseElement.AddHandler(UIElement.MouseWheelEvent, new MouseWheelEventHandler(MouseElement_MouseWheel), true);
     mouseElement.AddHandler(UIElement.MouseUpEvent, new MouseButtonEventHandler(MouseElement_MouseUp), true);
     mouseElement.AddHandler(UIElement.MouseRightButtonUpEvent, new MouseButtonEventHandler(MouseElement_MouseRightButtonUp), true);
     mouseElement.AddHandler(UIElement.MouseRightButtonDownEvent, new MouseButtonEventHandler(MouseElement_MouseRightButtonDown), true);
     mouseElement.AddHandler(UIElement.MouseMoveEvent, new MouseEventHandler(MouseElement_MouseMove), true);
     mouseElement.AddHandler(UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(MouseElement_MouseLeftButtonUp), true);
     mouseElement.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(MouseElement_MouseLeftButtonDown), true);
     mouseElement.AddHandler(UIElement.MouseLeaveEvent, new MouseEventHandler(MouseElement_MouseLeave), true);
     mouseElement.AddHandler(UIElement.MouseEnterEvent, new MouseEventHandler(MouseElement_MouseEnter), true);
     mouseElement.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(MouseElement_MouseDown), true);
     mouseElement.AddHandler(UIElement.GiveFeedbackEvent, new GiveFeedbackEventHandler(MouseElement_GiveFeedback), true);
     mouseElement.AddHandler(UIElement.DropEvent, new DragEventHandler(MouseElement_Drop), true);
     mouseElement.AddHandler(UIElement.DragOverEvent, new DragEventHandler(MouseElement_DragOver), true);
     mouseElement.AddHandler(UIElement.DragLeaveEvent, new DragEventHandler(MouseElement_DragLeave), true);
     mouseElement.AddHandler(UIElement.DragEnterEvent, new DragEventHandler(MouseElement_DragEnter), true);
     if (manipulationElement != null)
     {
         manipulationElement.AddHandler(UIElement.TouchUpEvent, new EventHandler <TouchEventArgs>(ManipulationElement_TouchUp), true);
         manipulationElement.AddHandler(UIElement.TouchDownEvent, new EventHandler <TouchEventArgs>(ManipulationElement_TouchDown), true);
         manipulationElement.AddHandler(UIElement.StylusSystemGestureEvent, new StylusSystemGestureEventHandler(ManipulationElement_StylusSystemGesture), true);
         manipulationElement.AddHandler(UIElement.ManipulationStartingEvent, new EventHandler <ManipulationStartingEventArgs>(ManipulationElement_ManipulationStarting), true);
         manipulationElement.AddHandler(UIElement.ManipulationInertiaStartingEvent, new EventHandler <ManipulationInertiaStartingEventArgs>(ManipulationElement_ManipulationInertiaStarting), true);
         manipulationElement.AddHandler(UIElement.ManipulationDeltaEvent, new EventHandler <ManipulationDeltaEventArgs>(ManipulationElement_ManipulationDelta), true);
         manipulationElement.AddHandler(UIElement.ManipulationCompletedEvent, new EventHandler <ManipulationCompletedEventArgs>(ManipulationElement_ManipulationCompleted), true);
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Adds a handler for the PreparePropertyItem attached event
 /// </summary>
 /// <param name="element">the element to attach the handler</param>
 /// <param name="handler">the handler for the event</param>
 public static void AddPreparePropertyItemHandler(UIElement element, PropertyItemEventHandler handler)
 {
     element.AddHandler(PropertyGrid.PreparePropertyItemEvent, handler);
 }
Esempio n. 27
0
 /// <summary>
 ///     Adds a handler for the KeyUp attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddKeyUpHandler(DependencyObject element, KeyEventHandler handler)
 {
     UIElement.AddHandler(element, KeyUpEvent, handler);
 }
Esempio n. 28
0
 /// <summary>
 /// Adds a handler for the ClearPropertyItem attached event
 /// </summary>
 /// <param name="element">the element to attach the handler</param>
 /// <param name="handler">the handler for the event</param>
 public static void AddClearPropertyItemHandler(UIElement element, PropertyItemEventHandler handler)
 {
     element.AddHandler(PropertyGrid.ClearPropertyItemEvent, handler);
 }
Esempio n. 29
0
		public static void AddCanExecuteHandler (UIElement element, CanExecuteRoutedEventHandler handler)
		{
			if (element == null) throw new ArgumentNullException ("element");
			if (handler == null) throw new ArgumentNullException ("handler");
			element.AddHandler (CanExecuteEvent, handler);
		}
Esempio n. 30
0
 /// <summary>
 ///     Adds a handler for the StylusInAirMove attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddStylusInAirMoveHandler(DependencyObject element, StylusEventHandler handler)
 {
     UIElement.AddHandler(element, StylusInAirMoveEvent, handler);
 }
Esempio n. 31
0
        public static void AddNameChangedHandler(DependencyObject d, RoutedEventHandler h)
        {
            UIElement e = d as UIElement;

            e?.AddHandler(Student.NameChangedEvent, h);
        }
Esempio n. 32
0
 /// <summary>
 ///     Adds a handler for the StylusEnter attached event
 /// </summary>
 /// <param name="element">UIElement or ContentElement that listens to this event</param>
 /// <param name="handler">Event Handler to be added</param>
 public static void AddStylusEnterHandler(DependencyObject element, StylusEventHandler handler)
 {
     UIElement.AddHandler(element, StylusEnterEvent, handler);
 }