Skip to content

Commit

Permalink
Fixes #851 by fixing some more logical tree issues
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Oct 3, 2020
1 parent eb0e7b7 commit 05f9c67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 44 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 6 additions & 38 deletions Fluent.Ribbon/Controls/Ribbon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ private static void OnContextMenuOpened(object sender, RoutedEventArgs e)

// Collection of tabs
private ObservableCollection<RibbonTabItem> tabs;
private CollectionSyncHelper<RibbonTabItem> tabsSync;

// Collection of toolbar items
private ObservableCollection<UIElement> toolBarItems;
Expand Down Expand Up @@ -824,52 +825,19 @@ public double QuickAccessToolBarHeight
/// Gets collection of contextual tab groups
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ObservableCollection<RibbonContextualTabGroup> ContextualGroups
{
get
{
if (this.contextualGroups == null)
{
this.contextualGroups = new ObservableCollection<RibbonContextualTabGroup>();
}

return this.contextualGroups;
}
}
public ObservableCollection<RibbonContextualTabGroup> ContextualGroups => this.contextualGroups ??= new ObservableCollection<RibbonContextualTabGroup>();

/// <summary>
/// gets collection of ribbon tabs
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ObservableCollection<RibbonTabItem> Tabs
{
get
{
if (this.tabs == null)
{
this.tabs = new ObservableCollection<RibbonTabItem>();
}

return this.tabs;
}
}
public ObservableCollection<RibbonTabItem> Tabs => this.tabs ??= new ObservableCollection<RibbonTabItem>();

/// <summary>
/// Gets collection of toolbar items
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ObservableCollection<UIElement> ToolBarItems
{
get
{
if (this.toolBarItems == null)
{
this.toolBarItems = new ObservableCollection<UIElement>();
}

return this.toolBarItems;
}
}
public ObservableCollection<UIElement> ToolBarItems => this.toolBarItems ??= new ObservableCollection<UIElement>();

/// <summary>
/// Gets collection of quick access menu items
Expand Down Expand Up @@ -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();
}
Expand All @@ -1520,7 +1488,7 @@ public override void OnApplyTemplate()
{
this.TabControl.SelectionChanged += this.OnTabControlSelectionChanged;

this.TabControl.ItemsSource = this.Tabs;
this.tabsSync = new CollectionSyncHelper<RibbonTabItem>(this.Tabs, this.TabControl.Items);

this.TabControl.SelectedItem = selectedTab;

Expand Down
6 changes: 0 additions & 6 deletions Fluent.Ribbon/Controls/RibbonTabControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1017,11 +1016,6 @@ protected override IEnumerator LogicalChildren
{
yield return baseEnumerator.Current;
}

if (this.SelectedContent != null)
{
yield return this.SelectedContent;
}
}
}
}
Expand Down

0 comments on commit 05f9c67

Please sign in to comment.