Пример #1
0
        public static void SetMappings(DependencyObject obj, EventsCollection value)
        {
            obj.SetValue(MappingsProperty, value);
            var element = obj as FrameworkElement;

            if (element == null)
            {
                throw new ArgumentException("Mappings need to be attached to a FrameworkElement");
            }
            value.SetParentFrameworkElement(element);
        }
Пример #2
0
        public static EventsCollection GetMappings(DependencyObject obj)
        {
            var eventsCollection = obj.GetValue(MappingsProperty) as EventsCollection;

            if (eventsCollection == null)
            {
                eventsCollection = new EventsCollection();
                SetMappings(obj, eventsCollection);
            }
            return(eventsCollection);
        }