Example #1
0
        private static bool TryCreateAdapter(TypeMemberKey key, out IPropertyAdapter adapter)
        {
            adapter = null;

            if (key.MemberName.IsEmpty)
            {
                return(false);
            }

            DependencyProperty dependencyProperty = DependencyProperty.GetProperty(key.Type, key.MemberName);

            if (dependencyProperty != null)
            {
                adapter = new DependencyPropertyAdapter(dependencyProperty);
                return(true);
            }

            PropertyInfo clrProperty = GetClrProperty(key.Type, key.MemberName);

            if (clrProperty != null)
            {
                adapter = new ClrPropertyAdapter(clrProperty);
                return(true);
            }

            return(false);
        }
Example #2
0
        private static bool TryCreateAdapter(TypeMemberKey key, out IEventAdapter adapter)
        {
            adapter = null;

            RoutedEvent routedEvent = GetRoutedEvent(key.Type, key.MemberName);

            if (routedEvent != null)
            {
                adapter = new RoutedEventAdapter(routedEvent);
                return(true);
            }

            EventInfo clrEvent = GetClrEvent(key.Type, key.MemberName);

            if (clrEvent != null)
            {
                adapter = new ClrEventAdapter(clrEvent);
                return(true);
            }

            PropertyInfo eventProperty = GetEventProperty(key.Type, key.MemberName);

            if (eventProperty != null)
            {
                adapter = new EventPropertyAdapter(eventProperty);
                return(true);
            }

            return(false);
        }
Example #3
0
        public override bool Equals(object obj)
        {
            TypeMemberKey other = obj as TypeMemberKey;

            return(Object.ReferenceEquals(this, other) || !Object.ReferenceEquals(other, null) &&
                   Object.Equals(this.Type, other.Type) &&
                   Object.Equals(this.MemberName, other.MemberName));
        }