diff --git a/src/Wpf.Ui/Controls/TitleBar/TitleBar.xaml b/src/Wpf.Ui/Controls/TitleBar/TitleBar.xaml index afdd69040..04ba6cea8 100644 --- a/src/Wpf.Ui/Controls/TitleBar/TitleBar.xaml +++ b/src/Wpf.Ui/Controls/TitleBar/TitleBar.xaml @@ -15,6 +15,7 @@ + @@ -45,9 +46,6 @@ - - - @@ -74,14 +72,6 @@ - - - - - - - - @@ -193,6 +183,7 @@ x:Name="PART_CloseButton" Grid.Column="4" ButtonType="Close" + MouseOverButtonsForeground="White" MouseOverBackground="{DynamicResource PaletteRedBrush}" /> diff --git a/src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs b/src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs index 876352858..e85dc4169 100644 --- a/src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs +++ b/src/Wpf.Ui/Controls/TitleBar/TitleBarButton.cs @@ -36,6 +36,19 @@ internal class TitleBarButton : Wpf.Ui.Controls.Button ) ); + /// + /// Property for . + /// + public static readonly DependencyProperty MouseOverButtonsForegroundProperty = DependencyProperty.Register( + nameof(MouseOverButtonsForeground), + typeof(Brush), + typeof(TitleBarButton), + new FrameworkPropertyMetadata( + SystemColors.ControlTextBrush, + FrameworkPropertyMetadataOptions.Inherits + ) + ); + /// /// Sets or gets the /// @@ -53,11 +66,20 @@ public Brush ButtonsForeground get => (Brush)GetValue(ButtonsForegroundProperty); set => SetValue(ButtonsForegroundProperty, value); } + /// + /// Foreground of the navigation buttons while mouse over. + /// + public Brush MouseOverButtonsForeground + { + get => (Brush)GetValue(MouseOverButtonsForegroundProperty); + set => SetValue(MouseOverButtonsForegroundProperty, value); + } public bool IsHovered { get; private set; } private User32.WM_NCHITTEST _returnValue; private Brush _defaultBackgroundBrush = Brushes.Transparent; //Should it be transparent? + private Brush _cacheButtonsForeground = SystemColors.ControlTextBrush; // cache ButtonsForeground while mouse over private bool _isClickedDown; @@ -70,6 +92,8 @@ public void Hover() return; Background = MouseOverBackground; + _cacheButtonsForeground = ButtonsForeground; + ButtonsForeground = MouseOverButtonsForeground; IsHovered = true; } @@ -82,6 +106,7 @@ public void RemoveHover() return; Background = _defaultBackgroundBrush; + ButtonsForeground = _cacheButtonsForeground; IsHovered = false; _isClickedDown = false; @@ -119,7 +144,6 @@ internal bool ReactToHwndHook(User32.WM msg, IntPtr lParam, out IntPtr returnInt RemoveHover(); return false; - case User32.WM.NCMOUSELEAVE: // Mouse leaves the window RemoveHover(); return false;