Ejemplo n.º 1
0
        private static void OnEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ImageSwitch control  = d as ImageSwitch;
            bool        newValue = (bool)e.NewValue;

            if (newValue)
            {
                VisualStateManager.GoToState(control, "Enabled", true);
            }
            else
            {
                VisualStateManager.GoToState(control, "Disabled", true);
            }
        }
Ejemplo n.º 2
0
        private static void OnCheckedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ImageSwitch control  = d as ImageSwitch;
            bool        newValue = (bool)e.NewValue;

            if (newValue)
            {
                VisualStateManager.GoToState(control, "Checked", true);
                control.KnobMove(true, true);
            }
            else
            {
                VisualStateManager.GoToState(control, "UnChecked", true);
                control.KnobMove(false, true);
            }
        }