Пример #1
0
        private static void OnSourceObjectChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            EventTriggerBase eventTriggerBase = (EventTriggerBase)obj;
            object           obj1             = eventTriggerBase.SourceNameResolver.Object;

            if (args.NewValue == null)
            {
                eventTriggerBase.OnSourceChanged(args.OldValue, obj1);
                return;
            }
            if (args.OldValue == null && obj1 != null)
            {
                eventTriggerBase.UnregisterEvent(obj1, eventTriggerBase.GetEventName());
            }
            eventTriggerBase.OnSourceChanged(args.OldValue, args.NewValue);
        }
        private static void OnSourceObjectChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            EventTriggerBase eventTriggerBase = (EventTriggerBase)obj;
            object           @object          = eventTriggerBase.SourceNameResolver.Object;

            if (args.NewValue == null)
            {
                eventTriggerBase.OnSourceChanged(args.OldValue, @object);
            }
            else
            {
                if (args.OldValue == null && @object != null)
                {
                    eventTriggerBase.UnregisterEvent(@object, eventTriggerBase.GetEventName());
                }
                eventTriggerBase.OnSourceChanged(args.OldValue, args.NewValue);
            }
        }