From 5af20512d4f4b8340dcbd686f65d27eacfcd409f Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Thu, 21 Sep 2017 22:22:19 +0200 Subject: [PATCH] Fixing #473 by not forcing measure on window but on titlebar instead --- Changelog.md | 1 + Fluent.Ribbon/Controls/RibbonWindow.cs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7da6f3274..9b7c2465f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -158,6 +158,7 @@ - [#464](../../issues/464) - Clicking on hyperlink inside of ApplicationMenu causes crash - [#465](../../issues/465) - Clicking on ContextualGroup background or scrolling through ribbon will open disabled tab During this fix `RibbonTabControl.GetFirstVisibleItem` was renamed to `RibbonTabControl.GetFirstVisibleAndEnabledItem`. + - [#473](../../issues/473) - RibbonWindow does not resize when Children resize and SizeToContent is used - ### Enhancements - `LayoutTransform` and `RenderTransform` can now be used directly on `RibbonWindow` as this now gets forwarded to the first template child of the window. Have a look at `TestWindow` in the showcase application for an example on how to use it. This was added as the fix for [#430](../../issues/430). diff --git a/Fluent.Ribbon/Controls/RibbonWindow.cs b/Fluent.Ribbon/Controls/RibbonWindow.cs index b2cd8e7fd..2f29c6d25 100644 --- a/Fluent.Ribbon/Controls/RibbonWindow.cs +++ b/Fluent.Ribbon/Controls/RibbonWindow.cs @@ -270,9 +270,9 @@ private void OnLoaded(object sender, RoutedEventArgs e) this.RunInDispatcherAsync(() => { - var availableSize = new Size(this.ActualWidth, this.ActualHeight); - this.Measure(availableSize); - this.Arrange(new Rect(default(Point), availableSize)); + var availableSize = new Size(this.TitleBar.ActualWidth, this.TitleBar.ActualHeight); + this.TitleBar.Measure(availableSize); + this.TitleBar.ForceMeasureAndArrange(); }, DispatcherPriority.ApplicationIdle); }