/// <summary> /// In loaded event hanlder, we will switch work space body /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UserControl_Loaded(object sender, RoutedEventArgs e) { int buttonIndex = int.Parse(this.SelectedButtonIndex); ToolbarButton b = (ToolbarButton)this.ToolBar.ButtonGroup[buttonIndex]; if (b != null) { ToolbarButton_MouseLeftButtonDown(b, null); } }
private void LogoutButton_Click(object sender, MouseButtonEventArgs e) { if (activeButton != null) { activeButton.Unselect(); } ToolbarButton logoutBtn = sender as ToolbarButton; logoutBtn.Unselect(); // Try log out // TODO: logout ModelProvider.Instance.LogoutAsync(Logout_Handle); }
/// <summary> /// Note down current active button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns>true if, switch to new page, false otherwise</returns> private bool HandleActiveButton(object sender, MouseButtonEventArgs e) { // Reclick the same active button, do nothing if (sender as ToolbarButton == activeButton) { return(false); } // Gray out previous active button if (activeButton != null) { activeButton.Unselect(); } // Set new active button activeButton = sender as ToolbarButton; activeButton.SelectButton(); // Return return(true); }
public static void OnTextValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ToolbarButton btn = d as ToolbarButton; btn.ButtonTextBlock.Text = btn.Text; }