From 8aa811e93950bca8de4fe58039a3b1978271e61d Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Wed, 16 Dec 2015 19:11:39 +0100 Subject: [PATCH] Fixes #223 by adding check for ResizeMode --- .../Controls/RibbonContextualTabGroup.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Fluent.Ribbon/Controls/RibbonContextualTabGroup.cs b/Fluent.Ribbon/Controls/RibbonContextualTabGroup.cs index ba3e33788..ee34f5eff 100644 --- a/Fluent.Ribbon/Controls/RibbonContextualTabGroup.cs +++ b/Fluent.Ribbon/Controls/RibbonContextualTabGroup.cs @@ -128,7 +128,7 @@ static RibbonContextualTabGroup() } // Coerce object style - static object OnCoerceStyle(DependencyObject d, object basevalue) + private static object OnCoerceStyle(DependencyObject d, object basevalue) { if (basevalue == null) { @@ -304,14 +304,11 @@ protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) if (e.ClickCount == 1 && firstVisibleItem != null) { - if (firstVisibleItem.TabControlParent != null) - { - var currentSelectedItem = firstVisibleItem.TabControlParent.SelectedItem as RibbonTabItem; + var currentSelectedItem = firstVisibleItem.TabControlParent?.SelectedItem as RibbonTabItem; - if (currentSelectedItem != null) - { - currentSelectedItem.IsSelected = false; - } + if (currentSelectedItem != null) + { + currentSelectedItem.IsSelected = false; } e.Handled = true; @@ -343,6 +340,11 @@ protected override void OnMouseDoubleClick(MouseButtonEventArgs e) return; } + if (this.parentWidow.ResizeMode == ResizeMode.NoResize) + { + return; + } + this.parentWidow.WindowState = this.parentWidow.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; @@ -363,4 +365,4 @@ private void OnParentWindowStateChanged(object sender, EventArgs e) this.IsWindowMaximized = this.parentWidow.WindowState == WindowState.Maximized; } } -} +} \ No newline at end of file