private void toggleButton_Unchecked(object sender, RoutedEventArgs e) { SidebarToggleButton button = sender as SidebarToggleButton; if (button == null) { return; } button.IsChecked = true; }
private void toggleButton_Checked(object sender, RoutedEventArgs e) { foreach (SidebarToggleButton button in _toggleButtons) { SidebarToggleButton toggleButton = button as SidebarToggleButton; if (toggleButton != null && toggleButton != sender) { toggleButton.InternalSetCheckedState(false, false); } } }
private void AddEventHandlersToButtons(IList newItems) { if (newItems == null) { return; } foreach (object item in newItems) { SidebarToggleButton toggleButton = (SidebarToggleButton)item; toggleButton.Checked += toggleButton_Checked; toggleButton.Unchecked += toggleButton_Unchecked; } }
private void RemoveEventHandlersFromButtons(IList oldItems) { if (oldItems == null) { return; } foreach (object item in oldItems) { SidebarToggleButton toggleButton = (SidebarToggleButton)item; toggleButton.Checked -= toggleButton_Checked; toggleButton.Unchecked -= toggleButton_Unchecked; } }
public void RegisterToggleButton(SidebarToggleButton button) { _toggleButtons.Add(button); }