Theme : dark global ToolTip style
WPF's default ToolTip is a white-on-black system look that clashes
with the dark theme — visible whenever the user hovers a button with
ToolTip="…", a health banner pill, the « ⋯ » menu hint, etc.
Global TargetType=ToolTip style :
Background : Brush.Bg.Card
Foreground : Brush.Text.Primary
Border : Brush.Border, 1 px, 6 px corner radius
Padding : 12 × 8 (more breathing room than default)
MaxWidth : 360 — so the longer health-banner tooltips wrap to a
second/third line instead of running off the right edge
HasDropShadow : true (the only WPF-native cue that says « this is a
tooltip floating above » since we removed the OS skin)
Inner TextBlock style cascades TextWrapping=Wrap on string-content
tooltips so multi-line messages format nicely.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -287,6 +287,47 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ToolTip sombre.
|
||||
Le ToolTip natif WPF est blanc + texte noir + corner radius zéro,
|
||||
look Win 7-ish qui jure complètement avec le thème dark. On le
|
||||
re-template : fond Bg.Card, bordure Border, texte Text.Primary,
|
||||
coins arrondis, padding plus généreux, et MaxWidth pour que les
|
||||
tooltips longs (ex. health banner avec 4-5 lignes de détail)
|
||||
wrappent au lieu de filer en hors-écran. -->
|
||||
<Style TargetType="ToolTip">
|
||||
<Setter Property="Background" Value="{StaticResource Brush.Bg.Card}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Brush.Border}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="12,8" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="MaxWidth" Value="360" />
|
||||
<Setter Property="HasDropShadow" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToolTip">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
CornerRadius="6">
|
||||
<ContentPresenter>
|
||||
<ContentPresenter.Resources>
|
||||
<!-- ContentPresenter wrapping ToolTip Content :
|
||||
si Content est une string, on veut un TextBlock
|
||||
qui wrappe. Sinon c'est un visual user-fourni. -->
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="Foreground" Value="{StaticResource Brush.Text.Primary}" />
|
||||
</Style>
|
||||
</ContentPresenter.Resources>
|
||||
</ContentPresenter>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ComboBox sombre.
|
||||
Re-template minimal pour avoir le contenu, l'arrow et le popup tous en
|
||||
palette dark. WPF native ComboBox style serait grisé sur blanc. -->
|
||||
|
||||
Reference in New Issue
Block a user