Example #1
0
        private static void EnableStateTriggersChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            var element = obj as FrameworkElement;

            if (element == null)
            {
                throw new NotSupportedException("EnableStateTriggers can only be applied on elements of type System.Windows.FrameworkElement");
            }

            if ((bool)e.NewValue)
            {
                VisualStateManagerHook.Set(element);
            }
            else
            {
                VisualStateManagerHook.UnSet(element);
            }
        }
Example #2
0
        internal static void Set(FrameworkElement element)
        {
            var hook = new VisualStateManagerHook(element);

            element.SetValue(VisualStateManagerHookProperty, hook);
        }