Skip to content

Commit

Permalink
Fix maximize button wrong bg after changing theme
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Jun 28, 2024
1 parent e79c477 commit 6d5c79e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion samples/WpfApp1/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
xmlns:local="clr-namespace:WpfApp1" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
ResizeMode="CanMinimize"
ui:ThemeManager.IsThemeAware="True"
ui:TitleBar.ExtendViewIntoTitleBar="False" ui:WindowHelper.SystemBackdropType="Acrylic"
ui:WindowHelper.ApplyNoise="False"
Expand Down
17 changes: 11 additions & 6 deletions source/iNKORE.UI.WPF.Modern/Helpers/Styles/SnapLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class SnapLayout

private Button _button;

private SolidColorBrush _hoverColor;
private SolidColorBrush _pressedColor;
private string _hoverColorKey;
private string _pressedColorKey;

public Button Target { get { return _button; } }

Expand Down Expand Up @@ -146,13 +146,15 @@ private void RefreshButtonColor()
{
if (_isButtonClicked)
{
_button.Background = _pressedColor;
//_button.Background = _pressedColor;
_button.SetResourceReference(Button.BackgroundProperty, _pressedColorKey);
}
else
{
if (_isButtonFocused)
{
_button.Background = _hoverColor;
//_button.Background = _hoverColor;
_button.SetResourceReference(Button.BackgroundProperty, _hoverColorKey);
}
else
{
Expand Down Expand Up @@ -200,8 +202,11 @@ private void RaiseButtonClick()

private void SetHoverColor()
{
_hoverColor = (SolidColorBrush)UIApplication.Current.FindResource("SystemControlHighlightListLowBrush") ?? new SolidColorBrush(Color.FromArgb(21, 255, 255, 255));
_pressedColor = (SolidColorBrush)UIApplication.Current.FindResource("SystemControlHighlightListMediumBrush") ?? new SolidColorBrush(Color.FromArgb(50, 0, 0, 0));
//_hoverColor = (SolidColorBrush)UIApplication.Current.FindResource("SystemControlHighlightListLowBrush") ?? new SolidColorBrush(Color.FromArgb(21, 255, 255, 255));
//_pressedColor = (SolidColorBrush)UIApplication.Current.FindResource("SystemControlHighlightListMediumBrush") ?? new SolidColorBrush(Color.FromArgb(50, 0, 0, 0));

_hoverColorKey = "SystemControlHighlightListLowBrush";
_pressedColorKey = "SystemControlHighlightListMediumBrush";
}

}
Expand Down

0 comments on commit 6d5c79e

Please sign in to comment.