fix: enforce deep dark backgrounds on UserControls and inject explicit DataGrid/ComboBox templates to eliminate white backgrounds

This commit is contained in:
2026-10-20 20:48:08 +09:00
parent 8ff4021f42
commit 932d247d37
7 changed files with 143 additions and 30 deletions
+131 -24
View File
@@ -31,11 +31,15 @@
<FontFamily x:Key="ModernFont">Segoe UI, Apple SD Gothic Neo, Malgun Gothic</FontFamily>
<FontFamily x:Key="IconFont">Segoe MDL2 Assets, Segoe Fluent Icons</FontFamily>
<!-- Global System Brushes Override (WPF DataGrid 기본 선택색 덮어쓰기) -->
<!-- Global System Brushes Override (WPF DataGrid & Control 기본 시스템 브러시 덮어쓰기) -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#2563EB" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#FFFFFF" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#1E3A8A" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#1D4ED8" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#FFFFFF" />
<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="#1E293B" />
<SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" Color="#F8FAFC" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#0F172A" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="#F8FAFC" />
<!-- Nav Button Style -->
<Style x:Key="NavButtonStyle" TargetType="RadioButton">
@@ -56,7 +60,6 @@
Padding="12,0"
Margin="8,2">
<Grid>
<!-- Active Accent Indicator -->
<Rectangle x:Name="indicator"
Width="3.5"
Height="18"
@@ -201,16 +204,19 @@
</Style>
<!-- ============================================================================== -->
<!-- Modern ComboBox & ComboBoxItem Style (선택칸 고대비 가독성 강화) -->
<!-- Custom Modern ComboBox (완전한 Dark 템플릿 - 회색 시스템 버튼 원천 제거) -->
<!-- ============================================================================== -->
<Style TargetType="ComboBoxItem">
<!-- ComboBoxItem Style -->
<Style x:Key="ModernComboBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="Background" Value="#1E293B" />
<Setter Property="Foreground" Value="#F8FAFC" />
<Setter Property="Padding" Value="10,8" />
<Setter Property="Padding" Value="12,8" />
<Setter Property="FontSize" Value="13" />
<Setter Property="FontFamily" Value="{StaticResource ModernFont}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
@@ -227,7 +233,7 @@
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="itemBorder" Property="Background" Value="#1D4ED8" />
<Setter Property="Foreground" Value="#FFFFFF" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontWeight" Value="Bold" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -235,35 +241,110 @@
</Setter>
</Style>
<!-- ComboBox ToggleButton Template -->
<ControlTemplate x:Key="ComboBoxToggleButtonTemplate" TargetType="ToggleButton">
<Border x:Name="templateRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="6">
<Grid HorizontalAlignment="Right" Width="30">
<!-- Dropdown Arrow Icon -->
<TextBlock Text="&#xE70D;"
FontFamily="{StaticResource IconFont}"
FontSize="10"
Foreground="{StaticResource TextSecondaryBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource PrimaryAccentBrush}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource PrimaryAccentHoverBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- ComboBox Main Style -->
<Style TargetType="ComboBox">
<Setter Property="Background" Value="#0F172A" />
<Setter Property="Foreground" Value="#F8FAFC" />
<Setter Property="BorderBrush" Value="{StaticResource CardBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="8,4" />
<Setter Property="Padding" Value="10,6" />
<Setter Property="FontFamily" Value="{StaticResource ModernFont}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="ItemContainerStyle" Value="{StaticResource ModernComboBoxItemStyle}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid x:Name="templateRoot">
<Popup x:Name="PART_Popup"
AllowsTransparency="True"
IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom"
PopupAnimation="Slide">
<Border x:Name="dropDownBorder"
Background="#1E293B"
BorderBrush="#334155"
BorderThickness="1"
CornerRadius="6"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
<ScrollViewer x:Name="DropDownScrollViewer" Margin="2">
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Popup>
<!-- Toggle Button (Closed Box) -->
<ToggleButton x:Name="toggleButton"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Template="{StaticResource ComboBoxToggleButtonTemplate}" />
<!-- Content Area -->
<ContentPresenter x:Name="contentPresenter"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ============================================================================== -->
<!-- Modern DataGrid, ColumnHeader, Row, Cell Styles (그리드 선택칸 고대비 가독성 보장) -->
<!-- Modern DataGrid Sub-Styles (ColumnHeader, Row, Cell 완벽 바인딩) -->
<!-- ============================================================================== -->
<!-- 1. DataGrid Column Header (어두운 배경 + 밝고 선명한 텍스트) -->
<Style TargetType="DataGridColumnHeader">
<!-- 1. ColumnHeader Style -->
<Style x:Key="ModernColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#090D16" />
<Setter Property="Foreground" Value="#E2E8F0" />
<Setter Property="Foreground" Value="#93C5FD" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Padding" Value="12,10" />
<Setter Property="FontSize" Value="12.5" />
<Setter Property="Padding" Value="14,10" />
<Setter Property="BorderBrush" Value="#334155" />
<Setter Property="BorderThickness" Value="0,0,1,1" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style>
<!-- 2. DataGrid Cell (선택 시 텍스트 명확화) -->
<Style TargetType="DataGridCell">
<Setter Property="Padding" Value="10,8" />
<!-- 2. Cell Style -->
<Style x:Key="ModernCellStyle" TargetType="DataGridCell">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#F8FAFC" />
<Setter Property="Padding" Value="12,8" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
@@ -279,18 +360,19 @@
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#2563EB" />
<Setter Property="Foreground" Value="#FFFFFF" />
<Setter Property="FontWeight" Value="SemiBold" />
</Trigger>
</Style.Triggers>
</Style>
<!-- 3. DataGrid Row (호버 및 선택 시 진한 파란색 배경 + 순백색 글자 강제) -->
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="Transparent" />
<!-- 3. Row Style -->
<Style x:Key="ModernRowStyle" TargetType="DataGridRow">
<Setter Property="Background" Value="#1E293B" />
<Setter Property="Foreground" Value="#F8FAFC" />
<Setter Property="FontFamily" Value="{StaticResource ModernFont}" />
<Setter Property="FontSize" Value="12.5" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="BorderBrush" Value="#2D3748" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1E3A8A" />
@@ -299,14 +381,13 @@
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#2563EB" />
<Setter Property="Foreground" Value="#FFFFFF" />
<Setter Property="FontWeight" Value="SemiBold" />
</Trigger>
</Style.Triggers>
</Style>
<!-- 4. Global Modern DataGrid Style -->
<Style x:Key="ModernDataGridStyle" TargetType="DataGrid">
<Setter Property="Background" Value="{StaticResource CardBgBrush}" />
<Setter Property="Background" Value="#1E293B" />
<Setter Property="BorderBrush" Value="{StaticResource CardBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="#F8FAFC" />
@@ -322,9 +403,18 @@
<Setter Property="SelectionMode" Value="Single" />
<Setter Property="FontFamily" Value="{StaticResource ModernFont}" />
<Setter Property="FontSize" Value="12.5" />
<!-- 명시적 서브 스타일 세터 주입 (Windows 기본 흰색 테마 침투 차단) -->
<Setter Property="ColumnHeaderStyle" Value="{StaticResource ModernColumnHeaderStyle}" />
<Setter Property="RowStyle" Value="{StaticResource ModernRowStyle}" />
<Setter Property="CellStyle" Value="{StaticResource ModernCellStyle}" />
</Style>
<!-- CheckBox Style for DataGrid Selection -->
<!-- Default TargetType Styles for Implicit Binding -->
<Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource ModernColumnHeaderStyle}" />
<Style TargetType="DataGridCell" BasedOn="{StaticResource ModernCellStyle}" />
<Style TargetType="DataGridRow" BasedOn="{StaticResource ModernRowStyle}" />
<!-- CheckBox Style -->
<Style TargetType="CheckBox">
<Setter Property="Foreground" Value="#F8FAFC" />
<Setter Property="FontSize" Value="13" />
@@ -332,4 +422,21 @@
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<!-- ListBox & ListBoxItem Style -->
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#F8FAFC" />
<Setter Property="Padding" Value="8,4" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1E3A8A" />
<Setter Property="Foreground" Value="#FFFFFF" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#2563EB" />
<Setter Property="Foreground" Value="#FFFFFF" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>