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)); } }
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); }
/// <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); }
public static void AddUnselectedHandler(this UIElement element, SelectorEventHandler handler) { element.AddHandler(UnselectedEvent, handler); }
public static void HookAcquireFocus(UIElement element) { element.AddHandler(AcquireFocusEvent, new RoutedEventHandler(SetFocus)); }
/// <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); }
/// <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); }
/// <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); }
public static void AddErrorHandler(UIElement element, RoutedEventHandler handler) { element.AddHandler(ErrorEvent, handler); }
private void SearchBoxParent_Loaded(object sender, RoutedEventArgs e) { UIElement parent = (UIElement)sender; parent.AddHandler(KeyDownEvent, (KeyEventHandler)HandleListBoxNavigationKeys, true); }
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 }
internal static void UpdateHandler(this UIElement element, RoutedEvent routedEvent, Delegate handler) { element.RemoveHandler(routedEvent, handler); element.AddHandler(routedEvent, handler); }
public static void AddLastPageHandler(UIElement e, RoutedEventHandler handler) { e.AddHandler(LastPageEvent, handler); }
public static void AddContentChangedHandler(UIElement el, RoutedEventHandler handler) { el.AddHandler(ContentChangedEvent, handler); }
/// <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); }
/// <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); }
/// <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); }
public static void AddValidationDirtyHandler(this UIElement o, RoutedEventHandler handler) { o.AddHandler(ValidationDirtyEvent, handler); }
/// <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); }
/// <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); }
/// <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); }
public static void AddTappedHandler(UIElement element, TappedEventHandler handler) { element.AddHandler(TappedEvent, handler); }
internal static void AddHandlerInt(this UIElement uie, RoutedEvent routedEvent, Delegate handler, bool handledEventsToo) { uie.AddHandler(routedEvent, handler, handledEventsToo); }
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); } }
/// <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); }
/// <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); }
/// <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); }
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); }
/// <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); }
public static void AddNameChangedHandler(DependencyObject d, RoutedEventHandler h) { UIElement e = d as UIElement; e?.AddHandler(Student.NameChangedEvent, h); }
/// <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); }