Skip to content

Commit 6614a11

Browse files
committed
Added a property for whether to change the WindowStyle to match the TitleBar flow direction
1 parent 5b8ca62 commit 6614a11

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

components/TitleBar/src/TitleBar.Properties.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public partial class TitleBar : Control
5858
public static readonly DependencyProperty AutoConfigureCustomTitleBarProperty = DependencyProperty.Register(nameof(AutoConfigureCustomTitleBar), typeof(bool), typeof(TitleBar), new PropertyMetadata(true, AutoConfigureCustomTitleBarChanged));
5959

6060
#if WINAPPSDK
61+
/// <summary>
62+
/// The backing <see cref="DependencyProperty"/> for the <see cref="Window"/> property.
63+
/// </summary>
64+
public static readonly DependencyProperty AutoChangeWindowLayoutStyleProperty = DependencyProperty.Register(nameof(AutoChangeWindowLayoutStyle), typeof(bool), typeof(TitleBar), new PropertyMetadata(true));
65+
6166
/// <summary>
6267
/// The backing <see cref="DependencyProperty"/> for the <see cref="Window"/> property.
6368
/// </summary>
@@ -165,6 +170,15 @@ public bool AutoConfigureCustomTitleBar
165170
}
166171

167172
#if WINAPPSDK
173+
/// <summary>
174+
/// Gets or sets if the TitleBar should automatically change the Window's LayoutStyle to match the FlowDirection of the TitleBar (WASDK only).
175+
/// </summary>
176+
public bool AutoChangeWindowLayoutStyle
177+
{
178+
get => (bool)GetValue(AutoChangeWindowLayoutStyleProperty);
179+
set => SetValue(AutoChangeWindowLayoutStyleProperty, value);
180+
}
181+
168182
/// <summary>
169183
/// Gets or sets the window the TitleBar should configure (WASDK only).
170184
/// </summary>

components/TitleBar/src/TitleBar.WASDK.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ private void SetWASDKTitleBar()
5555
}
5656

5757
// Set the caption buttons to match the flow direction of the titlebar
58-
UpdateCaptionButtonsDirection(this.FlowDirection);
58+
if (AutoChangeWindowLayoutStyle)
59+
{
60+
UpdateCaptionButtonsDirection(this.FlowDirection);
61+
}
5962

6063
PART_ContentPresenter = GetTemplateChild(nameof(PART_ContentPresenter)) as ContentPresenter;
6164
PART_FooterPresenter = GetTemplateChild(nameof(PART_FooterPresenter)) as ContentPresenter;

0 commit comments

Comments
 (0)