Skip to content

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

Merged
pomianowski merged 3 commits intolepoco:developmentfrom
seasonyuu:development
Mar 13, 2024
Merged

Fix Close Button icon color in TitleBar while mouse over#993
pomianowski merged 3 commits intolepoco:developmentfrom
seasonyuu:development

Conversation

@seasonyuu
Copy link
Copy Markdown
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
Copy Markdown
Member

hey @seasonyuu, thanks for your contribution to the project

@pomianowski pomianowski merged commit 638277d into lepoco:development Mar 13, 2024
@koal44
Copy link
Copy Markdown
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
Copy Markdown
Contributor

koal44 commented Mar 16, 2024

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

@seasonyuu
Copy link
Copy Markdown
Contributor Author

seasonyuu commented Mar 17, 2024 via email

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants