diff --git a/Fluent/Controls/RibbonWindow.cs b/Fluent/Controls/RibbonWindow.cs index 9920e0637..36e21dcc5 100644 --- a/Fluent/Controls/RibbonWindow.cs +++ b/Fluent/Controls/RibbonWindow.cs @@ -12,6 +12,7 @@ namespace Fluent using System; using System.Diagnostics.CodeAnalysis; using System.Windows; + using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; @@ -28,10 +29,12 @@ namespace Fluent /// [SuppressMessage("Microsoft.Design", "CA1049")] [TemplatePart(Name = PART_Icon, Type = typeof(UIElement))] + [TemplatePart(Name = PART_ContentPresenter, Type = typeof(UIElement))] [TemplatePart(Name = PART_WindowCommands, Type = typeof(WindowCommands))] public class RibbonWindow : Window { private const string PART_Icon = "PART_Icon"; + private const string PART_ContentPresenter = "PART_ContentPresenter"; private const string PART_WindowCommands = "PART_WindowCommands"; private FrameworkElement iconImage; @@ -380,13 +383,6 @@ public override void OnApplyTemplate() this.WindowCommands = new WindowCommands(); } - var partWindowCommands = this.GetTemplateChild(PART_WindowCommands) as UIElement; - - if (partWindowCommands != null) - { - WindowChrome.SetIsHitTestVisibleInChrome(partWindowCommands, true); - } - this.iconImage = this.GetTemplateChild(PART_Icon) as FrameworkElement; if (this.iconImage != null) @@ -396,6 +392,20 @@ public override void OnApplyTemplate() this.iconImage.MouseUp += this.HandleIconMouseUp; } + var partContentPresenter = this.GetTemplateChild(PART_ContentPresenter) as UIElement; + + if (partContentPresenter != null) + { + WindowChrome.SetIsHitTestVisibleInChrome(partContentPresenter, true); + } + + var partWindowCommands = this.GetTemplateChild(PART_WindowCommands) as UIElement; + + if (partWindowCommands != null) + { + WindowChrome.SetIsHitTestVisibleInChrome(partWindowCommands, true); + } + // This has to be done when the theme is changed. Otherwise maximized windows have the wrong size. if (this.WindowState == WindowState.Maximized) { diff --git a/Fluent/Themes/Office2010/RibbonWindow.xaml b/Fluent/Themes/Office2010/RibbonWindow.xaml index 54e994780..95ca9608d 100644 --- a/Fluent/Themes/Office2010/RibbonWindow.xaml +++ b/Fluent/Themes/Office2010/RibbonWindow.xaml @@ -61,7 +61,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -143,7 +143,7 @@ - + - +