diff --git a/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs b/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs
index c03df53e..ecdfa591 100644
--- a/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs
+++ b/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs
@@ -448,29 +448,26 @@ public static void SetMinimizeButtonAvailability(Window window, TitleBarButtonAv
#endregion
+ #region ButtonGlyphStyle
+ public static readonly DependencyProperty ButtonGlyphStyleProperty =
+ DependencyProperty.RegisterAttached(
+ "ButtonGlyphStyle",
+ typeof(TitleBarButtonGlyphStyle?),
+ typeof(TitleBar),
+ new PropertyMetadata(null));
- //#region MaximizeButtonTouchOptimize
-
- //public static readonly DependencyProperty MaximizeButtonTouchOptimizeProperty =
- // DependencyProperty.RegisterAttached(
- // "MaximizeButtonTouchOptimize",
- // typeof(bool),
- // typeof(TitleBar),
- // new PropertyMetadata(false));
-
-
- //public static bool GetMaximizeButtonTouchOptimize(Window window)
- //{
- // return (bool)window.GetValue(MaximizeButtonTouchOptimizeProperty);
- //}
+ public static TitleBarButtonGlyphStyle? GetButtonGlyphStyle(Window window)
+ {
+ return (TitleBarButtonGlyphStyle?)window.GetValue(ButtonGlyphStyleProperty);
+ }
- //public static void SetMaximizeButtonTouchOptimize(Window window, bool value)
- //{
- // window.SetValue(MaximizeButtonTouchOptimizeProperty, value);
- //}
+ public static void SetButtonGlyphStyle(Window window, TitleBarButtonGlyphStyle? value)
+ {
+ window.SetValue(ButtonGlyphStyleProperty, value);
+ }
- //#endregion
+ #endregion
#region BackRequested
@@ -511,4 +508,10 @@ public enum TitleBarButtonAvailability
Disabled,
Enabled
}
+
+ public enum TitleBarButtonGlyphStyle
+ {
+ MDL2,
+ Fluent,
+ }
}
diff --git a/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.cs b/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.cs
index 885412de..32f07797 100644
--- a/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.cs
+++ b/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.cs
@@ -1,4 +1,5 @@
-using iNKORE.UI.WPF.Modern.Helpers;
+using iNKORE.UI.WPF.Helpers;
+using iNKORE.UI.WPF.Modern.Helpers;
using iNKORE.UI.WPF.Modern.Helpers.Styles;
using System;
using System.ComponentModel;
@@ -49,6 +50,7 @@ public TitleBarControl()
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, CloseWindow));
SetInsideTitleBar(this, true);
+ UpdateActualButtonGlyphStyle();
}
#region IsActive
@@ -349,7 +351,7 @@ internal static void SetInsideTitleBar(UIElement element, bool value)
private static void ButtonAvailabilityProperty_ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- (d as TitleBarControl)?.RefreshButtonActualAvailabilities();
+ (d as TitleBarControl)?.UpdateButtonActualAvailabilities();
}
public static readonly DependencyProperty CloseButtonAvailabilityProperty =
@@ -407,6 +409,34 @@ public TitleBarButtonAvailability MinimizeButtonActualAvailability
private set => SetValue(MinimizeButtonActualAvailabilityPropertyKey, value);
}
+ #endregion
+
+ #region ButtonGlyphStyle
+
+ public static readonly DependencyProperty ButtonGlyphStyleProperty =
+ TitleBar.ButtonGlyphStyleProperty.AddOwner(typeof(TitleBarControl), new PropertyMetadata(null, ButtonGlyphStyleProperty_ValueChanged));
+
+ private static void ButtonGlyphStyleProperty_ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ (d as TitleBarControl)?.UpdateActualButtonGlyphStyle();
+ }
+
+ public TitleBarButtonGlyphStyle? ButtonGlyphStyle
+ {
+ get { return (TitleBarButtonGlyphStyle?)GetValue(ButtonGlyphStyleProperty); }
+ set { SetValue(ButtonGlyphStyleProperty, value); }
+ }
+
+ public static readonly DependencyPropertyKey ActualButtonGlyphStylePropertyKey = DependencyProperty.RegisterReadOnly(nameof(ActualButtonGlyphStyle), typeof(TitleBarButtonGlyphStyle), typeof(TitleBarControl), new PropertyMetadata(TitleBarButtonGlyphStyle.MDL2));
+ public static readonly DependencyProperty ActualButtonGlyphStyleProperty = ActualButtonGlyphStylePropertyKey.DependencyProperty;
+
+ public TitleBarButtonGlyphStyle ActualButtonGlyphStyle
+ {
+ get => (TitleBarButtonGlyphStyle)GetValue(ActualButtonGlyphStyleProperty);
+ private set => SetValue(ActualButtonGlyphStylePropertyKey, value);
+ }
+
+
#endregion
private Button BackButton { get; set; }
@@ -479,8 +509,8 @@ protected override void OnVisualParentChanged(DependencyObject oldParent)
{
if (_parentWindow != null)
{
- descriptor_ResizeMode.RemoveValueChanged(_parentWindow, _window_ButtonAvailabilityShouldRefresh);
- descriptor_WindowStyle.RemoveValueChanged(_parentWindow, _window_ButtonAvailabilityShouldRefresh);
+ descriptor_ResizeMode.RemoveValueChanged(_parentWindow, _window_ButtonAvailabilityShouldUpdate);
+ descriptor_WindowStyle.RemoveValueChanged(_parentWindow, _window_ButtonAvailabilityShouldUpdate);
if (_altLeftBinding != null)
{
@@ -497,18 +527,18 @@ protected override void OnVisualParentChanged(DependencyObject oldParent)
{
_altLeftBinding = new KeyBinding(new GoBackCommand(this), Key.Left, ModifierKeys.Alt);
_parentWindow.InputBindings.Add(_altLeftBinding);
- descriptor_ResizeMode.AddValueChanged(_parentWindow, _window_ButtonAvailabilityShouldRefresh);
- descriptor_WindowStyle.AddValueChanged(_parentWindow, _window_ButtonAvailabilityShouldRefresh);
+ descriptor_ResizeMode.AddValueChanged(_parentWindow, _window_ButtonAvailabilityShouldUpdate);
+ descriptor_WindowStyle.AddValueChanged(_parentWindow, _window_ButtonAvailabilityShouldUpdate);
- RefreshButtonActualAvailabilities();
+ UpdateButtonActualAvailabilities();
}
}
- private void _window_ButtonAvailabilityShouldRefresh(object sender, EventArgs e)
+ private void _window_ButtonAvailabilityShouldUpdate(object sender, EventArgs e)
{
if(sender == _parentWindow)
{
- RefreshButtonActualAvailabilities();
+ UpdateButtonActualAvailabilities();
}
}
@@ -531,7 +561,7 @@ private void OnBackButtonClick(object sender, RoutedEventArgs e)
}
}
- public void RefreshButtonActualAvailabilities()
+ public void UpdateButtonActualAvailabilities()
{
// Close button
@@ -618,6 +648,10 @@ public void RefreshButtonActualAvailabilities()
InitializeSnapLayout();
}
+ public void UpdateActualButtonGlyphStyle()
+ {
+ ActualButtonGlyphStyle = ButtonGlyphStyle ?? (OSVersionHelper.OSVersion > new Version(10, 0, 22000) ? TitleBarButtonGlyphStyle.Fluent : TitleBarButtonGlyphStyle.MDL2);
+ }
private void OnLeftSystemOverlaySizeChanged(object sender, SizeChangedEventArgs e)
{
diff --git a/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.xaml b/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.xaml
index 861dd1fb..d6d6881e 100644
--- a/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.xaml
+++ b/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBarControl.xaml
@@ -170,6 +170,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/source/iNKORE.UI.WPF.Modern/Helpers/Styles/SnapLayout.cs b/source/iNKORE.UI.WPF.Modern/Helpers/Styles/SnapLayout.cs
index 6346ebf1..232a1270 100644
--- a/source/iNKORE.UI.WPF.Modern/Helpers/Styles/SnapLayout.cs
+++ b/source/iNKORE.UI.WPF.Modern/Helpers/Styles/SnapLayout.cs
@@ -31,14 +31,14 @@ public class SnapLayout
private double _dpiScale;
- private Button _button;
+ private TitleBarButton _button;
private string _hoverColorKey;
private string _pressedColorKey;
public Button Target { get { return _button; } }
- public void Register(Button button)
+ public void Register(TitleBarButton button)
{
_isButtonFocused = false;
_button = button;
@@ -147,18 +147,23 @@ private void RefreshButtonColor()
if (_isButtonClicked)
{
//_button.Background = _pressedColor;
- _button.SetResourceReference(Button.BackgroundProperty, _pressedColorKey);
+ //button.SetResourceReference(Button.BackgroundProperty, _pressedColorKey);
+ _button.Background = _button.PressedBackground;
}
else
{
if (_isButtonFocused)
{
//_button.Background = _hoverColor;
- _button.SetResourceReference(Button.BackgroundProperty, _hoverColorKey);
+ //_button.SetResourceReference(Button.BackgroundProperty, _hoverColorKey);
+ _button.Background = _button.HoverBackground;
+
}
else
{
- _button.Background = DefaultButtonBackground;
+ //_button.Background = DefaultButtonBackground;
+ _button.ClearValue(TitleBarButton.BackgroundProperty);
+
}
}
}
diff --git a/source/iNKORE.UI.WPF.Modern/Themes/Styles/Window.xaml b/source/iNKORE.UI.WPF.Modern/Themes/Styles/Window.xaml
index 14bdb099..7f319cb1 100644
--- a/source/iNKORE.UI.WPF.Modern/Themes/Styles/Window.xaml
+++ b/source/iNKORE.UI.WPF.Modern/Themes/Styles/Window.xaml
@@ -134,6 +134,7 @@
MaximizeButtonAvailability="{TemplateBinding primitives:TitleBar.MaximizeButtonAvailability}"
MinimizeButtonAvailability="{TemplateBinding primitives:TitleBar.MinimizeButtonAvailability}"
CloseButtonAvailability="{TemplateBinding primitives:TitleBar.CloseButtonAvailability}"
+ ButtonGlyphStyle="{TemplateBinding primitives:TitleBar.ButtonGlyphStyle}"
Style="{TemplateBinding primitives:TitleBar.Style}" />