private void OnHeaderButtonClick(object sender, RoutedEventArgs e) { var clickedStripItem = (sender as Button).DataContext as HeaderStripItem; if (clickedStripItem != SelectedItem) { SelectedItem = clickedStripItem; OnHeaderActivated(sender, e); } }