Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MahApps.Metro/Behaviours/BorderlessWindowBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ private void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
window.SetIsHitTestVisibleInChromeProperty<ContentPresenter>("PART_LeftWindowCommands");
window.SetIsHitTestVisibleInChromeProperty<ContentPresenter>("PART_RightWindowCommands");
window.SetIsHitTestVisibleInChromeProperty<ContentControl>("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.")]
Expand Down
14 changes: 14 additions & 0 deletions MahApps.Metro/Controls/MetroWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -977,11 +977,25 @@ protected void TitleBarMouseUp(object sender, MouseButtonEventArgs e)
}
}

/// <summary>
/// Gets the template child with the given name.
/// </summary>
/// <typeparam name="T">The interface type inheirted from DependencyObject.</typeparam>
/// <param name="name">The name of the template child.</param>
internal T GetPart<T>(string name) where T : DependencyObject
{
return GetTemplateChild(name) as T;
}

/// <summary>
/// Gets the template child with the given name.
/// </summary>
/// <param name="name">The name of the template child.</param>
internal DependencyObject GetPart(string name)
{
return GetTemplateChild(name);
}

private static void ShowSystemMenuPhysicalCoordinates(Window window, Point physicalScreenLocation)
{
if (window == null) return;
Expand Down
23 changes: 21 additions & 2 deletions MahApps.Metro/Controls/MetroWindowHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ internal static class MetroWindowHelpers
/// <summary>
/// Sets the IsHitTestVisibleInChromeProperty to a MetroWindow template child
/// </summary>
/// <param name="window">The MetroWindow</param>
/// <param name="name">The name of the template child</param>
/// <param name="window">The MetroWindow.</param>
/// <param name="name">The name of the template child.</param>
public static void SetIsHitTestVisibleInChromeProperty<T>(this MetroWindow window, string name) where T : DependencyObject
{
if (window == null)
Expand All @@ -32,6 +32,25 @@ public static void SetIsHitTestVisibleInChromeProperty<T>(this MetroWindow windo
}
}

/// <summary>
/// Sets the WindowChrome ResizeGripDirection to a MetroWindow template child.
/// </summary>
/// <param name="window">The MetroWindow.</param>
/// <param name="name">The name of the template child.</param>
/// <param name="direction">The direction.</param>
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);
}
}

/// <summary>
/// Adapts the WindowCommands to the theme of the first opened, topmost &amp;&amp; (top || right || left) flyout
/// </summary>
Expand Down