wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

MouseOverBackground not Set in TitleBar style

Open c0nstexpr opened this issue 1 year ago • 4 comments

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>

c0nstexpr avatar Mar 20 '24 06:03 c0nstexpr

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

seasonyuu avatar Mar 20 '24 14:03 seasonyuu

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.

c0nstexpr avatar Mar 20 '24 15:03 c0nstexpr

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

mq2151189 avatar Mar 21 '24 03:03 mq2151189

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>

seasonyuu avatar Mar 26 '24 06:03 seasonyuu