public static void SetWindowChromeResizeGripDirection(this MetroWindow window, string name, ResizeGripDirection direction) { if (window == null) { return; } IInputElement part = window.GetPart(name) as IInputElement; if (part != null) { WindowChrome.SetResizeGripDirection(part, direction); } }
/// <summary> /// Sets the WindowChrome ResizeGripDirection to a CrystalWindow template child. /// </summary> /// <param name="window">The CrystalWindow.</param> /// <param name="name">The name of the template child.</param> /// <param name="direction">The direction.</param> public static void SetWindowChromeResizeGripDirection([NotNull] this CrystalWindow window, string name, ResizeGripDirection direction) { if (window is null) { throw new ArgumentNullException(nameof(window)); } var inputElement = window.GetPart<IInputElement>(name); Debug.Assert(inputElement != null, $"{name} is not a IInputElement"); if (inputElement is not null && WindowChrome.GetResizeGripDirection(inputElement) != direction) { WindowChrome.SetResizeGripDirection(inputElement, direction); } }
/// <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) { throw new ArgumentNullException(nameof(window)); } var inputElement = window.GetPart(name) as IInputElement; Debug.Assert(inputElement != null, $"{name} is not a IInputElement"); if (WindowChrome.GetResizeGripDirection(inputElement) != direction) { WindowChrome.SetResizeGripDirection(inputElement, direction); } }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); WindowChrome.SetResizeGripDirection(this.FindChild <ResizeGrip>(UITreeType.Visual, child => true), ResizeGripDirection.BottomRight); }