Skip to content

Commit

Permalink
Another round of fixes for #834
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Sep 19, 2020
1 parent 43724e1 commit 4391a5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Fluent.Ribbon/Controls/InRibbonGallery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,8 @@ private static object CoerceSelectedItem(DependencyObject d, object basevalue)
public InRibbonGallery()
{
ContextMenuService.Coerce(this);

this.IsVisibleChanged += this.OnIsVisibleChanged;
}

#endregion
Expand Down Expand Up @@ -1142,6 +1144,13 @@ public override void OnApplyTemplate()
this.popupResizeBorder = this.GetTemplateChild("PART_PopupResizeBorder") as FrameworkElement;
}

private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var groupBox = UIHelper.GetParent<RibbonGroupBox>(this);

groupBox?.TryClearCacheAndResetStateAndScaleAndNotifyParentRibbonGroupsContainer();
}

private void OnPopupPreviewMouseUp(object sender, MouseButtonEventArgs e)
{
// Ignore mouse up when mouse donw is on expand button
Expand Down
7 changes: 6 additions & 1 deletion Fluent.Ribbon/Controls/RibbonGroupBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,12 @@ internal bool TryClearCacheAndResetStateAndScale()
return true;
}

internal bool TryClearCacheAndResetStateAndScaleAndNotifyParentRibbonGroupsContainer()
/// <summary>
/// Tries to clear the cache, reset the state and reset the scale.
/// If that succeeds the parent <see cref="RibbonGroupsContainer"/> is notified about that.
/// </summary>
/// <returns><c>true</c> if the cache was reset. Otherwise <c>false</c>.</returns>
public bool TryClearCacheAndResetStateAndScaleAndNotifyParentRibbonGroupsContainer()
{
// We should try to clear the entire cache.
// The entire cache should only be cleared if we don't do regular measuring, but only if some event outside our own measuring code caused size changes (such as elements getting visible/invisible or being added/removed).
Expand Down

0 comments on commit 4391a5c

Please sign in to comment.