private void OnLayoutDocumentPanePropertyChange(object sender, PropertyChangedEventArgs e) { if (string.Equals(e.PropertyName, "SelectedContent")) { Log.Debug("SelectedContent changed, activating the right ribbon tabs"); Log.Debug("Clearing data context of ribbon"); _ribbon.ClearValue(Ribbon.DataContextProperty); Log.Debug("Hiding all contextual groups"); foreach (var contextualTabGroup in _ribbon.ContextualGroups) { contextualTabGroup.Visibility = Visibility.Collapsed; } ActivateTabForCurrentlySelectedDocumentView(); } }