Resuelto el problema del tema oscuro.

This commit is contained in:
Miguel 2025-02-04 11:01:38 +01:00
parent 47e9d5bbbd
commit 7b5b6709bd
2 changed files with 176 additions and 48 deletions

View File

@ -9,7 +9,8 @@
<BitmapImage UriSource="/Assets/app.png" />
</Window.Icon>
<Grid Margin="20">
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="20" />
@ -103,4 +104,5 @@
<Button Content="Cancelar" Command="{Binding CancelCommand}" />
</StackPanel>
</Grid>
</Border>
</Window>

View File

@ -1,58 +1,184 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Colores para el tema oscuro -->
<SolidColorBrush x:Key="WindowBackground" Color="#1E1E1E"/>
<SolidColorBrush x:Key="WindowForeground" Color="#FFFFFF"/>
<SolidColorBrush x:Key="PrimaryBackground" Color="#2D2D2D"/>
<SolidColorBrush x:Key="SecondaryBackground" Color="#333333"/>
<SolidColorBrush x:Key="BorderBrush" Color="#404040"/>
<SolidColorBrush x:Key="ButtonBackground" Color="#3E3E3E"/>
<SolidColorBrush x:Key="ButtonBackgroundHover" Color="#4A4A4A"/>
<SolidColorBrush x:Key="TextBoxBackground" Color="#2D2D2D"/>
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Base Colors -->
<SolidColorBrush x:Key="WindowBackground" Color="#1E1E1E" />
<SolidColorBrush x:Key="WindowForeground" Color="#FFFFFF" />
<SolidColorBrush x:Key="PrimaryBackground" Color="#2D2D2D" />
<SolidColorBrush x:Key="SecondaryBackground" Color="#333333" />
<SolidColorBrush x:Key="BorderBrush" Color="#404040" />
<SolidColorBrush x:Key="ButtonBackground" Color="#3E3E3E" />
<SolidColorBrush x:Key="ButtonBackgroundHover" Color="#4A4A4A" />
<SolidColorBrush x:Key="TextBoxBackground" Color="#2D2D2D" />
<!-- Estilos para controles principales -->
<Style TargetType="Window">
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
</Style>
<!-- ScrollBar Colors -->
<SolidColorBrush x:Key="ScrollBarBackground" Color="#2D2D2D" />
<SolidColorBrush x:Key="ScrollBarBorder" Color="#404040" />
<SolidColorBrush x:Key="ScrollBarThumb" Color="#505050" />
<SolidColorBrush x:Key="ScrollBarThumbHover" Color="#606060" />
<SolidColorBrush x:Key="ScrollBarThumbPressed" Color="#707070" />
<Style TargetType="Grid">
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
</Style>
<!-- Base Control Styles -->
<Style TargetType="Window">
<Setter Property="Background" Value="{StaticResource WindowBackground}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
</Style>
<Style TargetType="Border">
<Setter Property="Background" Value="{StaticResource WindowBackground}"/>
</Style>
<Style TargetType="Grid">
<Setter Property="Background" Value="{StaticResource WindowBackground}" />
</Style>
<!-- Estilos para controles interactivos -->
<Style TargetType="Button">
<Setter Property="Background" Value="{StaticResource ButtonBackground}"/>
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
</Style>
<Style TargetType="Border">
<Setter Property="Background" Value="{StaticResource WindowBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
</Style>
<Style TargetType="TextBox">
<Setter Property="Background" Value="{StaticResource TextBoxBackground}"/>
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
</Style>
<Style TargetType="Button">
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
</Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="Background" Value="{StaticResource TextBoxBackground}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
</Style>
<Style TargetType="ComboBox">
<Setter Property="Background" Value="{StaticResource TextBoxBackground}"/>
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
</Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
</Style>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="{StaticResource TextBoxBackground}"/>
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
<Setter Property="Background" Value="{StaticResource PrimaryBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="checkBoxBorder" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="16" Height="16">
<Path x:Name="optionMark"
Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z"
Fill="{StaticResource WindowForeground}" Margin="1" Opacity="0" Stretch="Uniform" />
</Border>
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Opacity" TargetName="optionMark" Value="1" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="checkBoxBorder"
Value="{StaticResource ButtonBackground}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="checkBoxBorder"
Value="{StaticResource ButtonBackgroundHover}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ComboBox Style -->
<Style TargetType="ComboBox">
<Setter Property="Background" Value="{StaticResource PrimaryBackground}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<Border x:Name="border" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectionBoxItem.Description}"
Margin="5,2" VerticalAlignment="Center" />
<ToggleButton x:Name="toggleButton" Grid.Column="1" Width="20"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Background="Transparent" BorderThickness="0">
<Path Data="M0,0 L3,4 L6,0" Fill="{StaticResource WindowForeground}"
Stretch="Uniform" />
</ToggleButton>
</Grid>
</Border>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom"
PlacementTarget="{Binding ElementName=border}" PopupAnimation="Slide">
<Border Background="{StaticResource PrimaryBackground}"
BorderBrush="{StaticResource BorderBrush}" BorderThickness="1">
<ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
Background="{StaticResource PrimaryBackground}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="{StaticResource ButtonBackground}" />
</Trigger>
<Trigger Property="IsDropDownOpen" Value="True">
<Setter Property="Background" TargetName="border"
Value="{StaticResource ButtonBackgroundHover}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource WindowForeground}" />
<Setter Property="Padding" Value="5,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="Bd" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<TextBlock Text="{Binding Description}" Margin="2" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource ButtonBackground}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource ButtonBackgroundHover}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ScrollBar Style -->
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="{StaticResource ScrollBarBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource ScrollBarBorder}" />
</Style>
<Style TargetType="ScrollViewer">
<Setter Property="Background" Value="{StaticResource WindowBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
<Setter Property="Padding" Value="1" />
</Style>
<Style TargetType="CheckBox">
<Setter Property="Foreground" Value="{StaticResource WindowForeground}"/>
</Style>
</ResourceDictionary>