Example #1
0
        public static void SetTriggers(DependencyObject obj, TriggersCollection value)
        {
            obj.SetValue(TriggersProperty, value);
            var element = obj as FrameworkElement;

            if (element == null)
            {
                throw new ArgumentException("Interactions need to be attached to a FrameworkElement");
            }
            value.SetDependencyObject(element);
        }
Example #2
0
        public static TriggersCollection GetTriggers(DependencyObject obj)
        {
            var triggersCollection = obj.GetValue(TriggersProperty) as TriggersCollection;

            if (triggersCollection == null)
            {
                triggersCollection = new TriggersCollection();
                SetTriggers(obj, triggersCollection);
            }
            return(triggersCollection);
        }