Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Close Button icon color in TitleBar while mouse over #993

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

seasonyuu
Copy link
Contributor

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

Normally, the TitleBar should change Close button background to Red, and change foreground to White while mouse over. But it looks like this now.

image

Issue Number: N/A

What is the new behavior?

image

Because the TitleBar.cs hook mouse event, so the TemplateBinding in TitleBar.xaml cannot trigger by IsMouseOver. So this pull request continuely use the Hover/RemoveHover method in TitleBarButton.cs as event, and add a MouseOverButtonsForeground property to allow user defining this color.

Other information

@seasonyuu seasonyuu requested a review from pomianowski as a code owner March 13, 2024 06:42
@pomianowski
Copy link
Member

hey @seasonyuu, thanks for your contribution to the project

@pomianowski pomianowski merged commit 638277d into lepoco:development Mar 13, 2024
1 of 2 checks passed
@koal44
Copy link
Contributor

koal44 commented Mar 16, 2024

This PR has some bugs that should be worked out.

  1. Binding failures in TitleBar.xaml
<Setter Property="MouseOverButtonsForeground" Value="{Binding Path=MouseOverButtonsForeground, RelativeSource={RelativeSource AncestorType={x:Type controls:TitleBar}}}" />

There's no such property for TitleBar but there was one introduced for TitleBarButton. But anyhoo, the line can be omitted as the styling logic is entirely handled in code through TitleBarButton.Hover()

  1. The ButtonsForeground is now broken when switching themes
    To reproduce the bug: run the gallery app, hover over the TitleBar buttons (like minimize or close buttons), then switch themes and you'll see that the foreground is now stuck to the previous theme.
    The reason for this is ButtonsForeground = _cacheButtonsForeground, which breaks the theme binding from
    <Setter Property="ButtonsForeground" Value="{DynamicResource ButtonForeground}" />

@koal44
Copy link
Contributor

koal44 commented Mar 16, 2024

image
as seen here, the buttons become invisible when switching to light theme

@seasonyuu
Copy link
Contributor Author

seasonyuu commented Mar 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants