lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.33k stars 707 forks source link

MouseOverBackground not Set in TitleBar style #1009

Open c0nstexpr opened 5 months ago

c0nstexpr commented 5 months ago

Describe the bug

The MouseOverBackground is referenced here https://github.com/lepoco/wpfui/blob/f59daa02e4c4818989d7f95dbb4bcb95b279b747/src/Wpf.Ui/Controls/TitleBar/TitleBar.xaml#L18 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>
seasonyuu commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

seasonyuu commented 5 months ago

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>