diff --git a/Changelog.md b/Changelog.md index 9838646e8..3b2658136 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ - [#840](../../issues/840) - Ribbon does not scroll anymore - [#848](../../issues/848) - Colorful-Theme and Fullscreen Issue - [#849](../../issues/849) - QuickAccessToolBar not editable anymore (thanks @chrfin) + - [#851](../../issues/851) - Tab KeyTips Are Shown Together With Tab-Item KeyTips (different to 7.0.0) ## 8.0.0 diff --git a/Fluent.Ribbon/Controls/Ribbon.cs b/Fluent.Ribbon/Controls/Ribbon.cs index 156a60805..7651cea89 100644 --- a/Fluent.Ribbon/Controls/Ribbon.cs +++ b/Fluent.Ribbon/Controls/Ribbon.cs @@ -495,6 +495,7 @@ private static void OnContextMenuOpened(object sender, RoutedEventArgs e) // Collection of tabs private ObservableCollection tabs; + private CollectionSyncHelper tabsSync; // Collection of toolbar items private ObservableCollection toolBarItems; @@ -824,52 +825,19 @@ public double QuickAccessToolBarHeight /// Gets collection of contextual tab groups /// [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public ObservableCollection ContextualGroups - { - get - { - if (this.contextualGroups == null) - { - this.contextualGroups = new ObservableCollection(); - } - - return this.contextualGroups; - } - } + public ObservableCollection ContextualGroups => this.contextualGroups ??= new ObservableCollection(); /// /// gets collection of ribbon tabs /// [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public ObservableCollection Tabs - { - get - { - if (this.tabs == null) - { - this.tabs = new ObservableCollection(); - } - - return this.tabs; - } - } + public ObservableCollection Tabs => this.tabs ??= new ObservableCollection(); /// /// Gets collection of toolbar items /// [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public ObservableCollection ToolBarItems - { - get - { - if (this.toolBarItems == null) - { - this.toolBarItems = new ObservableCollection(); - } - - return this.toolBarItems; - } - } + public ObservableCollection ToolBarItems => this.toolBarItems ??= new ObservableCollection(); /// /// Gets collection of quick access menu items @@ -1509,7 +1477,7 @@ public override void OnApplyTemplate() this.TabControl.SelectionChanged -= this.OnTabControlSelectionChanged; selectedTab = this.TabControl.SelectedItem as RibbonTabItem; - this.TabControl.ItemsSource = null; + this.tabsSync?.Target.Clear(); this.toolBarItemsSync?.Target.Clear(); } @@ -1520,7 +1488,7 @@ public override void OnApplyTemplate() { this.TabControl.SelectionChanged += this.OnTabControlSelectionChanged; - this.TabControl.ItemsSource = this.Tabs; + this.tabsSync = new CollectionSyncHelper(this.Tabs, this.TabControl.Items); this.TabControl.SelectedItem = selectedTab; diff --git a/Fluent.Ribbon/Controls/RibbonTabControl.cs b/Fluent.Ribbon/Controls/RibbonTabControl.cs index 9c00f8135..61a6bfa23 100644 --- a/Fluent.Ribbon/Controls/RibbonTabControl.cs +++ b/Fluent.Ribbon/Controls/RibbonTabControl.cs @@ -15,7 +15,6 @@ namespace Fluent using System.Windows.Input; using ControlzEx.Standard; using Fluent.Automation.Peers; - using Fluent.Collections; using Fluent.Extensions; using Fluent.Helpers; using Fluent.Internal; @@ -1017,11 +1016,6 @@ protected override IEnumerator LogicalChildren { yield return baseEnumerator.Current; } - - if (this.SelectedContent != null) - { - yield return this.SelectedContent; - } } } }