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

MouseOverBackground not Set in TitleBar style #1009

Open
c0nstexpr opened this issue Mar 20, 2024 · 4 comments
Open

MouseOverBackground not Set in TitleBar style #1009

c0nstexpr opened this issue Mar 20, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@c0nstexpr
Copy link

Describe the bug

The MouseOverBackground is referenced here

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

But I find nowhere at latter TitleBar style setting

To Reproduce

Load the gallery project and run the gallery application. We will see multiple (4 in my case) bind failures.

Expected behavior

No bind failures

Screenshots

No response

OS version

Win 10 19045.4170

.NET version

Same as repo

WPF-UI NuGet version

Same as repo

Additional context

Temporary Workaround for user:

<ui:TitleBar>
    <ui:TitleBar.Resources>
        <Style TargetType="ui:TitleBarButton" BasedOn="{StaticResource {x:Type ui:TitleBarButton}}">
            <Setter Property="MouseOverButtonsForeground" Value="Black" />
        </Style>
    </ui:TitleBar.Resources>
</ui:TitleBar>
@c0nstexpr c0nstexpr added the bug Something isn't working label Mar 20, 2024
@seasonyuu
Copy link
Contributor

Got it. By the way, what do you want in your issue? Did you want to change all the TitleBarButton MouseOverButtonsForeground in one time?

@c0nstexpr
Copy link
Author

Got it. By the way, what do you want in your issue? Did you want to change all the TitleBarButton MouseOverButtonsForeground in one time?

Maybe not, the title buttons have different functionalities. Usually the close button background is red and foreground white when hovered, while the others foreground is black. Not pertty sure since I not good at UI design.
Provide a way to set different button's color should be good.

@mq2151189
Copy link

ThemesDictionary Theme="Dark" TitleBar Button Foreground Is Black
屏幕截图 2024-03-21 111145

@pomianowski pomianowski pinned this issue Mar 22, 2024
@seasonyuu
Copy link
Contributor

image

Is this what you want?

  <ui:TitleBar
      x:Name="TitleBar"
      Title="{Binding ViewModel.ApplicationTitle}"
      Grid.Row="0"
      CloseWindowByDoubleClickOnIcon="True">
      <ui:TitleBar.Resources>
          <Style TargetType="ui:TitleBarButton" BasedOn="{StaticResource {x:Type ui:TitleBarButton}}">
              <Setter Property="ButtonsForeground" Value="Red" />
              <Setter Property="MouseOverButtonsForeground" Value="Blue" />
          </Style>
      </ui:TitleBar.Resources>
      <ui:TitleBar.Icon>
          <ui:ImageIcon Source="pack://application:,,,/Assets/wpfui.png" />
      </ui:TitleBar.Icon>
  </ui:TitleBar>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants