Example #1
0
 public MouseButtonEventArgs(RoutedEvent routedEvent, object originalSource, MouseDevice mouseDevice, int timestamp, Point absolutePosition, MouseButton changedButton, MouseButtonState buttonState, int clickCount)
     : base(routedEvent, originalSource, mouseDevice, timestamp, absolutePosition)
 {
     this.ChangedButton = changedButton;
     this.ButtonState = buttonState;
     this.ClickCount = clickCount;
 }
        public MFTestResults UIElement_RaiseEvent_FocusChangedEvent_Test2()
        {
            MFTestResults testResult = MFTestResults.Pass;
            Log.Comment("Raising FocusChangedEventEvents and Verifying");
            //addToEvtRoute = false;
            btnEvent = false;
            fcsEvent = true;
            _fcsEventCntr = 0;
            rEvents = new RoutedEvent[] { Buttons.GotFocusEvent, Buttons.LostFocusEvent };
            for (int i = 0; i < rEvents.Length; i++)
            {
                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                 new DispatcherOperationCallback(AddToHandler), rEvents[i]);

                FocusChangedEventArgs fcea = new FocusChangedEventArgs(null, DateTime.Now, mainWindow, mainWindow);
                fcea.RoutedEvent = rEvents[i];

                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                    new DispatcherOperationCallback(RaiseEvent), fcea);
                if (_fcsEventCntr != i + 1)
                {
                    Log.Comment("FocusChangedEvent '" + rEvents[i].Name + "' event not raised");
                    testResult = MFTestResults.Fail;
                }
            }
            fcsEvent = false;

            return testResult;
        }
Example #3
0
        private static void AddRoutedEventHandler(
            Hashtable table,
            RoutedEvent routedEvent,
            RoutedEventHandler handler,
            bool handledEventsToo)
        {
            if (routedEvent == null || handler == null)
            {
                throw new ArgumentNullException();
            }

            // Create a new RoutedEventHandler
            RoutedEventHandlerInfo routedEventHandlerInfo =
                new RoutedEventHandlerInfo(handler, handledEventsToo);

            // Get the entry corresponding to the given RoutedEvent
            ArrayList handlers = (ArrayList)table[routedEvent];
            if (handlers == null)
            {
                table[routedEvent] = (handlers = new ArrayList());
            }

            // Add the RoutedEventHandlerInfo to the list
            handlers.Add(routedEventHandlerInfo);
        }
        public MFTestResults UIElement_RaiseEvent_ButtonEvent_Test1()
        {
            MFTestResults testResult = MFTestResults.Pass;
            Log.Comment("Raising ButtonEvents and Verifying");
            //addToEvtRoute = false;
            btnEvent = true;
            fcsEvent = false;
            _btnEventCntr = 0;
            rEvents = new RoutedEvent[] { Buttons.ButtonDownEvent, Buttons.ButtonUpEvent,             
                Buttons.PreviewButtonDownEvent, Buttons.PreviewButtonUpEvent};
            for (int i = 0; i < rEvents.Length; i++)
            {
                //rEvent = rEvents[i];
                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                    new DispatcherOperationCallback(AddToHandler), rEvents[i]);

                ButtonEventArgs bea = new ButtonEventArgs(null, null, DateTime.Now, Hardware.Button.AppDefined1);
                bea.RoutedEvent = rEvents[i];

                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                    new DispatcherOperationCallback(RaiseEvent), bea);
                if (_btnEventCntr != i + 1)
                {
                    Log.Comment("ButtonEvent '" + rEvents[i].Name + "' event not raised");
                    testResult = MFTestResults.Fail;
                }
            }
            btnEvent = false;

            return testResult;
        }
 public static void AddHandler(object target, RoutedEvent routedEvent, Delegate handler, bool handledEventsToo) {
     if (null == target)
         throw new ArgumentNullException("target");
     if (null == routedEvent)
         throw new ArgumentNullException("routedEvent");
     if (null == handler)
         throw new ArgumentNullException("handler");
     //
     RoutedEventKey key = routedEvent.Key;
     if (!routedEvents.ContainsKey(key))
         throw new ArgumentException("Specified routed event is not registered.", "routedEvent");
     RoutedEventInfo routedEventInfo = routedEvents[key];
     bool needAddTarget = true;
     if (routedEventInfo.targetsList != null) {
         RoutedEventTargetInfo targetInfo = routedEventInfo.targetsList.FirstOrDefault(info => info.target == target);
         if (null != targetInfo) {
             if (targetInfo.handlersList == null)
                 targetInfo.handlersList = new List<DelegateInfo>();
             targetInfo.handlersList.Add(new DelegateInfo(handler, handledEventsToo));
             needAddTarget = false;
         }
     }
     if (needAddTarget) {
         RoutedEventTargetInfo targetInfo = new RoutedEventTargetInfo(target);
         targetInfo.handlersList = new List<DelegateInfo>();
         targetInfo.handlersList.Add(new DelegateInfo(handler, handledEventsToo));
         if (routedEventInfo.targetsList == null)
             routedEventInfo.targetsList = new List<RoutedEventTargetInfo>();
         routedEventInfo.targetsList.Add(targetInfo);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyValueChangedEventArgs"/> class.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="property">The property.</param>
 /// <param name="oldValue">The old value.</param>
 public PropertyValueChangedEventArgs(RoutedEvent routedEvent, PropertyItem property, object oldValue)
     : base(routedEvent, property)
 {
     Property = property;
     NewValue = property.PropertyValue;
     OldValue = oldValue;
 }
 public MouseButtonEventArgs(object source, RoutedEvent routedEvent, Point rawPosition,
                             MouseButtonState leftButton, MouseButtonState middleButton,
                             MouseButtonState rightButton,
                             MouseButton button, int clickCount = 1)
     : base(source, routedEvent, rawPosition, leftButton, middleButton, rightButton) {
     this.button = button;
     this.clickCount = clickCount;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlRoutedEventHandlerMutator"/> class.
        /// </summary>
        /// <param name="revtID">The event which is being mutated.</param>
        /// <param name="revtHandler">The event handler to add to the event.</param>
        public UvmlRoutedEventHandlerMutator(RoutedEvent revtID, UvmlNode revtHandler)
        {
            Contract.Require(revtID, nameof(revtID));
            Contract.Require(revtHandler, nameof(revtHandler));

            this.revtID = revtID;
            this.revtHandler = revtHandler;
        }
Example #9
0
 public WpfXamlMember(RoutedEvent re,
     MethodInfo setter,
     XamlSchemaContext schemaContext, 
     bool useV3Rules)
     : base(re.Name, setter, schemaContext) 
 { 
     RoutedEvent = re;
     _useV3Rules = useV3Rules; 
     _underlyingMemberIsKnown = true;
 }
Example #10
0
 public WpfXamlMember(RoutedEvent re, 
     EventInfo eventInfo,
     XamlSchemaContext schemaContext, 
     bool useV3Rules) 
     : base(eventInfo, schemaContext)
 { 
     RoutedEvent = re;
     _useV3Rules = useV3Rules;
     _underlyingMemberIsKnown = true;
 } 
Example #11
0
 public WpfXamlMember(RoutedEvent re, bool isAttachable) 
     : base(re.Name,
            System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(re.OwnerType), 
            isAttachable) 
 {
     RoutedEvent = re; 
     _useV3Rules = true;
     _isBamlMember = true;
     _underlyingMemberIsKnown = false;
 } 
 public ScrollChangedEventArgs(RoutedEvent routedEvent, object originalSource, Point offset, Point offsetChange, Size extent, Point extentChange, Size viewport, Point viewportChange)
     : base(routedEvent, originalSource)
 {
     this.Offset = offset;
     this.OffsetChange = offsetChange;
     this.Extent = extent;
     this.ExtentChange = extentChange;
     this.Viewport = viewport;
     this.ViewportChange = viewportChange;
 }
Example #13
0
        /// <summary>
        /// Removes a handler for a routed event from the specified input element.
        /// </summary>
        /// <param name="dobj">The input element from which to remove the event handler.</param>
        /// <param name="routedEvent">A <see cref="RoutedEvent"/> that identifies the routed event for which to remove a handler.</param>
        /// <param name="handler">A delegate that represents the handler to remove from the element for the specified routed event.</param>
        public static void RemoveHandler(DependencyObject dobj, RoutedEvent routedEvent, Delegate handler)
        {
            var element = dobj as IInputElement;
            if (element != null)
            {
                element.RemoveHandler(routedEvent, handler);
                return;
            }

            throw new ArgumentException(PresentationStrings.NotAnInputElement.Format("dobj"));
        }
Example #14
0
        public void Tunneling_Event_Should_Tunnel()
        {
            var ev = new RoutedEvent("test", RoutingStrategies.Tunnel, typeof(RoutedEventArgs), typeof(TestInteractive));
            var invoked = new List<string>();
            EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
            var target = CreateTree(ev, handler, RoutingStrategies.Bubble | RoutingStrategies.Tunnel);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(new[] { "1", "2b" }, invoked);
        }
Example #15
0
 internal MouseButtonEventArgs(RoutedEvent routedEvent,
     MouseButton changedButton,
     MouseButtonState buttonState,
     int clickCount,
     System.Windows.Input.MouseButtonEventArgs args)
     : base(routedEvent)
 {
     this.ChangedButton = changedButton;
     this.ButtonState = buttonState;
     this.ClickCount = clickCount;
     this.originalMouseButtonEventArgs = args;
 }
Example #16
0
        public void Direct_Event_Should_Go_Straight_To_Source()
        {
            var ev = new RoutedEvent("test", RoutingStrategies.Direct, typeof(RoutedEventArgs), typeof(TestInteractive));
            var invoked = new List<string>();
            EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
            var target = CreateTree(ev, handler, RoutingStrategies.Direct);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(new[] { "2b" }, invoked);
        }
Example #17
0
        /// <inheritdoc/>
        void IRoutedEventRaisedNotificationSubscriber.ReceiveRoutedEventRaisedNotification(DependencyObject dobj, RoutedEvent evt, RoutedEventData data)
        {
            if (!data.Handled || handled)
            {
                Activate(dobj);

                if (setHandled)
                {
                    data.Handled = true;
                }
            }
        }
Example #18
0
 public ContentShouldBeScrolledEventArgs( object source, RoutedEvent routedEvent,
     int? mostLeftVisibleX, int? mostRightVisibleX,
     int? mostTopVisibleY, int? mostBottomVisibleY)
     : base(source, routedEvent) {
     if (mostLeftVisibleX.HasValue && mostRightVisibleX.HasValue)
         throw new ArgumentException("Only one of X values can be specified");
     if (mostTopVisibleY.HasValue && mostBottomVisibleY.HasValue)
         throw new ArgumentException("Only one of Y values can be specified");
     this.mostLeftVisibleX = mostLeftVisibleX;
     this.mostRightVisibleX = mostRightVisibleX;
     this.mostTopVisibleY = mostTopVisibleY;
     this.mostBottomVisibleY = mostBottomVisibleY;
 }
		public MouseDevice ()
		{
			PreviewButtonPressEvent = new TunnelingEvent<MouseButtonEventArgs> ();
			ButtonPressEvent = new BubblingEvent<MouseButtonEventArgs> (); 

			PreviewButtonReleaseEvent = new TunnelingEvent<MouseButtonEventArgs> ();
			ButtonReleaseEvent = new BubblingEvent<MouseButtonEventArgs> (); 

			PreviewMotionNotifyEvent = new TunnelingEvent<MouseButtonEventArgs> ();
			MotionNotifyEvent = new BubblingEvent<MouseButtonEventArgs> ();

			MouseEnterEvent = new DirectEvent<EventArgs> ();
			MouseLeaveEvent = new DirectEvent<EventArgs> ();
		}
		private static void AttachEvent(RoutedEvent e, PointerEventHandler Handler)
		{
			foreach (var item in Panels)
			{
				if (e == UIElement.PointerPressedEvent)
					item.PointerPressed += Handler;
				else if (e == UIElement.PointerEnteredEvent)
					item.PointerEntered += Handler;
				else if (e == UIElement.PointerExitedEvent)
					item.PointerExited += Handler;
			}
			foreach (var item in NonPanels)
			{
				item.AddHandler(e, Handler, true);
			}
		}
		private static void DetachEvent(RoutedEvent e, PointerEventHandler Handler)
		{
			foreach (var item in Panels)
			{
				if (e == UIElement.PointerPressedEvent)
					item.PointerPressed -= Handler;
				else if (e == UIElement.PointerEnteredEvent)
					item.PointerEntered -= Handler;
				else if (e == UIElement.PointerExitedEvent)
					item.PointerExited -= Handler;
			}
			foreach (var item in NonPanels)
			{
				item.RemoveHandler(e, Handler);
			}
		}
Example #22
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="id">event id</param>
        /// <param name="action">UndoAction</param>
        /// <param name="changes">ReadOnlyCollection</param>
        public TextChangedEventArgs(RoutedEvent id, UndoAction action, ICollection<TextChange> changes) : base()
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }

            if (action < UndoAction.None || action > UndoAction.Create)
            {
                throw new InvalidEnumArgumentException("action", (int)action, typeof(UndoAction));
            }

            RoutedEvent=id;
            _undoAction = action;
            _changes = changes;
        }
 public static RoutedEvent RegisterRoutedEvent(string name, RoutingStrategy routingStrategy, Type handlerType, Type ownerType) {
     if (string.IsNullOrEmpty(name))
         throw new ArgumentException("name");
     if (null == handlerType)
         throw new ArgumentNullException("handlerType");
     if (null == ownerType)
         throw new ArgumentNullException("ownerType");
     //
     RoutedEventKey key = new RoutedEventKey(name, ownerType);
     if (routedEvents.ContainsKey(key)) {
         throw new InvalidOperationException("This routed event is already registered.");
     }
     RoutedEvent routedEvent = new RoutedEvent(handlerType, name, ownerType, routingStrategy);
     RoutedEventInfo routedEventInfo = new RoutedEventInfo(routedEvent);
     routedEvents.Add(key, routedEventInfo);
     return routedEvent;
 }
Example #24
0
        public void Direct_Event_Should_Have_Route_Set_To_Direct()
        {
            var ev = new RoutedEvent("test", RoutingStrategies.Direct, typeof(RoutedEventArgs), typeof(TestInteractive));
            bool called = false;

            EventHandler<RoutedEventArgs> handler = (s, e) =>
            {
                Assert.Equal(RoutingStrategies.Direct, e.Route);
                called = true;
            };

            var target = CreateTree(ev, handler, RoutingStrategies.Direct);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.True(called);
        }
Example #25
0
 /// <summary>
 /// Adds the owner.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="ownerType">Type of the owner.</param>
 internal static void AddOwner(RoutedEvent routedEvent, Type ownerType)
 {
     if ((ownerType == typeof(DependencyObject)) || ownerType.IsSubclassOf(typeof(DependencyObject)))
     {
         List<RoutedEvent> list2;
         var type = DependencyObjectType.FromSystemTypeInternal(ownerType);
         var obj3 = dependencyTypedRoutedEventList[type];
         if (obj3 == null)
         {
             list2 = new List<RoutedEvent>();
             dependencyTypedRoutedEventList[type] = list2;
         }
         else
         {
             list2 = (List<RoutedEvent>)obj3;
         }
         if (!list2.Contains(routedEvent))
         {
             list2.Add(routedEvent);
         }
     }
     else
     {
         List<RoutedEvent> list;
         object obj2 = null;
         if (ownerTypedRoutedEventList.ContainsKey(ownerType))
         {
             obj2 = ownerTypedRoutedEventList[ownerType];
         }
         if (obj2 == null)
         {
             list = new List<RoutedEvent>();
             ownerTypedRoutedEventList[ownerType] = list;
         }
         else
         {
             list = (List<RoutedEvent>)obj2;
         }
         if (!list.Contains(routedEvent))
         {
             list.Add(routedEvent);
         }
     }
 }
Example #26
0
        public void Bubbling_Class_Handlers_Should_Be_Called()
        {
            var ev = new RoutedEvent(
                "test",
                RoutingStrategies.Bubble | RoutingStrategies.Tunnel,
                typeof(RoutedEventArgs),
                typeof(TestInteractive));
            var invoked = new List<string>();
            EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);

            var target = this.CreateTree(ev, null, 0);

            ev.AddClassHandler(typeof(TestInteractive), handler, RoutingStrategies.Bubble);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(new[] { "2b", "1" }, invoked);
        }
Example #27
0
        public void Bubbling_Subscription_Should_Not_Catch_Tunneling()
        {
            var ev = new RoutedEvent(
                "test",
                RoutingStrategies.Bubble | RoutingStrategies.Tunnel,
                typeof(RoutedEventArgs),
                typeof(TestInteractive));
            var count = 0;

            EventHandler<RoutedEventArgs> handler = (s, e) =>
            {
                Assert.Equal(RoutingStrategies.Bubble, e.Route);
                ++count;
            };

            var target = this.CreateTree(ev, handler, RoutingStrategies.Bubble);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(2, count);
        }
 public ItemDeletingEventArgs(RoutedEvent itemDeletingEvent, object itemDeleting)
     : base(itemDeletingEvent)
 {
     _item = itemDeleting;
 }
Example #29
0
        private void RaiseRoutedEvent(RoutedEvent routedEvent)
        {
            var args = new RoutedEventArgs(routedEvent, this);

            RaiseEvent(args);
        }
Example #30
0
        public static void RaiseEvent(this FrameworkElement element, MouseButton mouseButton, RoutedEvent routedEvent)
        {
            MouseButtonEventArgs args = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left);

            args.RoutedEvent = UIElement.MouseLeftButtonDownEvent;
            args.Source      = element;
            element.RaiseEvent(args);
        }
 /// <summary>
 /// Creates a new <see cref="SearchEventArgs" />.
 /// </summary>
 /// <param name="routedEvent"></param>
 /// <param name="source">The source object</param>
 /// <param name="searchTerm">The term to search for</param>
 public SearchEventArgs(RoutedEvent routedEvent, object source, string searchTerm)
     : base(routedEvent, source)
 {
     SearchTerm = searchTerm;
 }
Example #32
0
 protected void BindEvent(UnityEvent source, RoutedEvent routedEvent) => eventHandlers.BindEvent(this, source, routedEvent);
Example #33
0
 protected void UnbindEvent(UnityEvent source, RoutedEvent routedEvent) => eventHandlers.UnbindEvent(source, routedEvent);
Example #34
0
 public ClockChoiceMadeEventArgs(ClockDisplayMode displayMode, RoutedEvent routedEvent) : base(routedEvent)
 {
     _displayMode = displayMode;
 }
Example #35
0
 public ClockChoiceMadeEventArgs(ClockDisplayMode displayMode, RoutedEvent routedEvent, object source) : base(routedEvent, source)
 {
     _displayMode = displayMode;
 }
 public CollectionItemChangedEventArgs(IEnumerable array, IReadOnlyCollection <object> changes, EventType eventType, object?item, int index, RoutedEvent @event) : base(eventType, item, index, @event)
 {
     Objects = array;
     Changes = changes;
 }
Example #37
0
        public void Events_Should_Have_Route_Set()
        {
            var ev = new RoutedEvent(
                "test",
                RoutingStrategies.Bubble | RoutingStrategies.Tunnel,
                typeof(RoutedEventArgs),
                typeof(TestInteractive));
            var invoked = new List<RoutingStrategies>();
            EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(e.Route);
            var target = CreateTree(ev, handler, RoutingStrategies.Bubble | RoutingStrategies.Tunnel);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(new[]
            {
                RoutingStrategies.Tunnel,
                RoutingStrategies.Tunnel,
                RoutingStrategies.Bubble,
                RoutingStrategies.Bubble,
            },
            invoked);
        }
Example #38
0
 public TextBoxValueChangedEventArgs(T oldValue, T newValue, bool isManual, bool isBusy, RoutedEvent routedEvent)
     : base(oldValue, newValue, routedEvent)
 {
     IsManual = isManual;
     IsBusy   = isBusy;
 }
Example #39
0
 public CollectionChangeEventArgs(RoutedEvent routedEvent, Dictionary <object, int> dictionary) : base(routedEvent)
 {
     this.Dictionary = dictionary;
 }
Example #40
0
 public GifImageExceptionRoutedEventArgs(RoutedEvent routedEvent, object obj)
     : base(routedEvent, obj)
 {
 }
Example #41
0
 public MWKeyEventArgs(RoutedEvent routedEvent, Key key, ModifierKeys modifierKeys) : base(routedEvent)
 {
     Key       = key;
     Modifiers = modifierKeys;
 }
Example #42
0
 private void OnRaiseEvent(RoutedEvent handler, MouseButtonEventArgs e)
 {
     e.RoutedEvent = handler;
     RaiseEvent(e);
 }
Example #43
0
 public CardModelEventArgs(DataNew.Entities.Card model, RoutedEvent routedEvent, object source)
     : base(routedEvent, source)
 {
     CardModel = model;
 }
Example #44
0
        private TestInteractive CreateTree(
            RoutedEvent ev,
            EventHandler<RoutedEventArgs> handler,
            RoutingStrategies handlerRoutes,
            bool handledEventsToo = false)
        {
            TestInteractive target;

            var tree = new TestInteractive
            {
                Name = "1",
                Children = new[]
                {
                    new TestInteractive
                    {
                        Name = "2a",
                    },
                    (target = new TestInteractive
                    {
                        Name = "2b",
                        Children = new[]
                        {
                            new TestInteractive
                            {
                                Name = "3",
                            },
                        },
                    }),
                }
            };

            if (handler != null)
            {
                foreach (var i in tree.GetSelfAndVisualDescendents().Cast<Interactive>())
                {
                    i.AddHandler(ev, handler, handlerRoutes, handledEventsToo);
                }
            }

            return target;
        }
Example #45
0
 public NoteEventArgs(RoutedEvent routedEvent, Note note) : base(routedEvent)
 {
     this.Note = note;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ScheduledAppointmentEventArgs"/> class. Constructs a new custom
 /// ScheduledAppointmentEventArgs object using the parameters provided
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="appointmentKey">The scheduled appointment.</param>
 public ScheduledAppointmentEventArgs(RoutedEvent routedEvent, IVisit appointmentKey)
     : base(routedEvent)
 {
     this.appointmentKey = appointmentKey;
 }
Example #47
0
 protected void RemoveHandler(RoutedEvent routedEvent, RoutedEventHandler handler) => eventHandlers.RemoveHandler(routedEvent, handler);
Example #48
0
 public GamePadEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source)
 {
 }
Example #49
0
 protected void AddHandler(RoutedEvent routedEvent, RoutedEventHandler handler) => eventHandlers.AddHandler(routedEvent, handler);
Example #50
0
        /// <summary>
        /// Helper function to create a RoutedPropertyChangedEventArgs from a DependencyPropertyChangedEventArgs.
        /// </summary>
        /// <typeparam name="T">The type for the RoutedPropertyChangedEventArgs.</typeparam>
        /// <param name="propertyEventArgs">The DependencyPropertyChangedEventArgs data source.</param>
        /// <param name="routedEvent">The routed event the property change is associated with.</param>
        /// <returns>The created event args, configured from the parameter.</returns>
        public static RoutedPropertyChangedEventArgs <T> CreateRoutedPropertyChangedEventArgs <T>(DependencyPropertyChangedEventArgs propertyEventArgs, RoutedEvent routedEvent)
        {
            RoutedPropertyChangedEventArgs <T> eventArgs = new RoutedPropertyChangedEventArgs <T>(
                (T)propertyEventArgs.OldValue,
                (T)propertyEventArgs.NewValue,
                routedEvent);

            return(eventArgs);
        }
 public CollectionEventArgs(EventType eventType, RoutedEvent @event) : base(@event)
 {
     EventType = eventType;
 }
 public PropertyViewItemEventArgs(RoutedEvent routedEvent, object source, PropertyViewItem container, object item)
     : base(routedEvent, source)
 {
     Container = container;
     Item      = item;
 }
 public MovementEventArgs(IReadOnlyCollection <IndexedObject> array, IReadOnlyCollection <IndexedObject> changes, EventType eventType, object?item, int index, RoutedEvent @event) : base(eventType, item, index, @event)
 {
     Objects = array;
     Changes = changes;
 }
Example #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AvaloniaEventHandlerItem"/> class
 /// with the specified element name, element, event name, routed event, event information,
 /// event handler, and a value that indicates whether to register the handler such that
 /// it is invoked even when the event is marked handled in its event data.
 /// </summary>
 /// <param name="elementName">The name of the element that raises the event.</param>
 /// <param name="element">The element that raises the event.</param>
 /// <param name="eventName">The name of the event.</param>
 /// <param name="routedEvent">The routed event that is raised.</param>
 /// <param name="eventInfo">The information of the event that is raised</param>
 /// <param name="handler">The handler of the event.</param>
 /// <param name="handledEventsToo">
 /// <c>true</c> to register the handler such that it is invoked even when the
 /// event is marked handled in its event data; <c>false</c> to register the
 /// handler with the default condition that it will not be invoked if the event
 /// is already marked handled.
 /// </param>
 public AvaloniaEventHandlerItem(string elementName, StyledElement element, string eventName, RoutedEvent routedEvent, EventInfo eventInfo, Delegate handler, bool handledEventsToo) : base(elementName, element, eventName, handler, handledEventsToo)
 {
     this.routedEvent = routedEvent;
     this.eventInfo   = eventInfo;
 }
Example #55
0
 public RotateRoutedEventArgs(RoutedEvent routedEvent, Object source, List <RotateTransform> result) : base(routedEvent, source)
 {
     MyProperty = result;;
 }
Example #56
0
 public MoveRoutedEventArgs(RoutedEvent routedEvent, Object source, List <List <double> > result) : base(routedEvent, source)
 {
     MyProperty = result;;
 }
        //Helper for Choice_Buttons
        public static RoutedEventHandlerInfo[] GetRoutedEventHandlers(UIElement element, RoutedEvent routedEvent)
        {
            // Get the EventHandlersStore instance which holds event handlers for the specified element.
            // The EventHandlersStore class is declared as internal.
            var eventHandlersStoreProperty = typeof(UIElement).GetProperty(
                "EventHandlersStore", BindingFlags.Instance | BindingFlags.NonPublic);
            object eventHandlersStore = eventHandlersStoreProperty.GetValue(element, null);

            // Invoke the GetRoutedEventHandlers method on the EventHandlersStore instance
            // for getting an array of the subscribed event handlers.
            var getRoutedEventHandlers = eventHandlersStore.GetType().GetMethod(
                "GetRoutedEventHandlers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            var routedEventHandlers = (RoutedEventHandlerInfo[])getRoutedEventHandlers.Invoke(
                eventHandlersStore, new object[] { routedEvent });

            return(routedEventHandlers);
        }
Example #58
0
 public ReportTimeEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectionChangedEventArgs"/> class.
 /// </summary>
 /// <param name="routedEvent">The event being raised.</param>
 /// <param name="addedItems">The items added to the selection.</param>
 /// <param name="removedItems">The items removed from the selection.</param>
 public SelectionChangedEventArgs(RoutedEvent routedEvent, IList addedItems, IList removedItems)
     : base(routedEvent)
 {
     AddedItems = addedItems;
     RemovedItems = removedItems;
 }
 public CollectionItemEventArgs(EventType eventType, object?item, int index, RoutedEvent @event) : base(eventType, @event)
 {
     Item  = item;
     Index = index;
 }