diff --git a/MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs b/MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs index 5987d1b6c7..e7b167e6b4 100644 --- a/MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs +++ b/MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs @@ -314,6 +314,8 @@ private void AssociatedObject_Loaded(object sender, RoutedEventArgs e) window.SetIsHitTestVisibleInChromeProperty("PART_LeftWindowCommands"); window.SetIsHitTestVisibleInChromeProperty("PART_RightWindowCommands"); window.SetIsHitTestVisibleInChromeProperty("PART_WindowButtonCommands"); + + window.SetWindowChromeResizeGripDirection("WindowResizeGrip", ResizeGripDirection.BottomRight); } [Obsolete(@"This property will be deleted in the next release. You should use BorderThickness=""0"" and a GlowBrush=""Black"" properties in your Window to get a drop shadow around it.")] diff --git a/MahApps.Metro/Controls/MetroWindow.cs b/MahApps.Metro/Controls/MetroWindow.cs index 4e1f2fa4e9..d12b7800a8 100644 --- a/MahApps.Metro/Controls/MetroWindow.cs +++ b/MahApps.Metro/Controls/MetroWindow.cs @@ -977,11 +977,25 @@ protected void TitleBarMouseUp(object sender, MouseButtonEventArgs e) } } + /// + /// Gets the template child with the given name. + /// + /// The interface type inheirted from DependencyObject. + /// The name of the template child. internal T GetPart(string name) where T : DependencyObject { return GetTemplateChild(name) as T; } + /// + /// Gets the template child with the given name. + /// + /// The name of the template child. + internal DependencyObject GetPart(string name) + { + return GetTemplateChild(name); + } + private static void ShowSystemMenuPhysicalCoordinates(Window window, Point physicalScreenLocation) { if (window == null) return; diff --git a/MahApps.Metro/Controls/MetroWindowHelpers.cs b/MahApps.Metro/Controls/MetroWindowHelpers.cs index ab5c1dc20b..463ba2772b 100644 --- a/MahApps.Metro/Controls/MetroWindowHelpers.cs +++ b/MahApps.Metro/Controls/MetroWindowHelpers.cs @@ -17,8 +17,8 @@ internal static class MetroWindowHelpers /// /// Sets the IsHitTestVisibleInChromeProperty to a MetroWindow template child /// - /// The MetroWindow - /// The name of the template child + /// The MetroWindow. + /// The name of the template child. public static void SetIsHitTestVisibleInChromeProperty(this MetroWindow window, string name) where T : DependencyObject { if (window == null) @@ -32,6 +32,25 @@ public static void SetIsHitTestVisibleInChromeProperty(this MetroWindow windo } } + /// + /// Sets the WindowChrome ResizeGripDirection to a MetroWindow template child. + /// + /// The MetroWindow. + /// The name of the template child. + /// The direction. + public static void SetWindowChromeResizeGripDirection(this MetroWindow window, string name, ResizeGripDirection direction) + { + if (window == null) + { + return; + } + var inputElement = window.GetPart(name) as IInputElement; + if (inputElement != null) + { + WindowChrome.SetResizeGripDirection(inputElement, direction); + } + } + /// /// Adapts the WindowCommands to the theme of the first opened, topmost && (top || right || left) flyout ///