/// <summary> /// Called when IsChecked is changed on "d." /// </summary> /// <param name="d">The object on which the property was changed.</param> /// <param name="e">EventArgs that contains the old and new values for this property</param> private static void OnIsCheckedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ToggleButton button = (ToggleButton)d; bool? oldValue = (bool?)e.OldValue; bool? newValue = (bool?)e.NewValue; //doing soft casting here because the peer can be that of RadioButton and it is not derived from //ToggleButtonAutomationPeer - specifically to avoid implementing TogglePattern ToggleButtonAutomationPeer peer = UIElementAutomationPeer.FromElement(button) as ToggleButtonAutomationPeer; if (peer != null) { peer.RaiseToggleStatePropertyChangedEvent(oldValue, newValue); } if (newValue == true) { button.OnChecked(new RoutedEventArgs(CheckedEvent)); } else if (newValue == false) { button.OnUnchecked(new RoutedEventArgs(UncheckedEvent)); } else { button.OnIndeterminate(new RoutedEventArgs(IndeterminateEvent)); } button.UpdateVisualState(); }
// Token: 0x060060EC RID: 24812 RVA: 0x001B2F60 File Offset: 0x001B1160 private static void OnIsCheckedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ToggleButton toggleButton = (ToggleButton)d; bool? oldValue = (bool?)e.OldValue; bool? flag = (bool?)e.NewValue; ToggleButtonAutomationPeer toggleButtonAutomationPeer = UIElementAutomationPeer.FromElement(toggleButton) as ToggleButtonAutomationPeer; if (toggleButtonAutomationPeer != null) { toggleButtonAutomationPeer.RaiseToggleStatePropertyChangedEvent(oldValue, flag); } if (flag == true) { toggleButton.OnChecked(new RoutedEventArgs(ToggleButton.CheckedEvent)); } else if (flag == false) { toggleButton.OnUnchecked(new RoutedEventArgs(ToggleButton.UncheckedEvent)); } else { toggleButton.OnIndeterminate(new RoutedEventArgs(ToggleButton.IndeterminateEvent)); } toggleButton.UpdateVisualState(); }