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); } }
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); } }