Skip to content
闫驚鏵(Jinhua Yan) edited this page May 14, 2023 · 2 revisions

Replace the topic in the App. xaml file node '<ResourceDictionary. MergedDictionaries>'

<Application x:Class="WPFDevelopers.Samples.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+            xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
             StartupUri="ExampleViews\MainWindow.xaml" ShutdownMode="OnMainWindowClose">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
-               <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml"/>
+               <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.***.xaml"/>
                <!--需要注意ws:Resources 必须再配色主题后,Theme="Dark" 为黑色皮肤-->
                <wd:Resources Theme="Light"/>
                <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Blue

 <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml"/>

image

Red

 <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Red.xaml"/>

image

Green

 <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Green.xaml"/>

image

Orange

 <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Orange.xaml"/>

image

Pink

 <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Pink.xaml"/>

image

Purple

 <ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Purple.xaml"/>

image

Please refer to the following for customized theme colors

  • Create a new theme resource Light.Carmine.xaml file.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" po:Freeze="True">
   
     <!--Default颜色-->
    <Color x:Key="WD.DefaultBorderBrushColor" po:Freeze="True">#CD7474</Color>
    <SolidColorBrush x:Key="WD.DefaultBorderBrushSolidColorBrush" Color="{StaticResource WD.DefaultBorderBrushColor}" po:Freeze="True"></SolidColorBrush>
    <Color x:Key="WD.DefaultBackgroundColor" po:Freeze="True">#CFA0A0</Color>
    <SolidColorBrush x:Key="WD.DefaultBackgroundSolidColorBrush" Color="{StaticResource WD.DefaultBackgroundColor}" po:Freeze="True"></SolidColorBrush>
    <Color x:Key="WD.DefaultBackgroundPressedColor" po:Freeze="True">#B70404</Color>
    <SolidColorBrush x:Key="WD.DefaultBackgroundPressedSolidColorBrush" Color="{StaticResource WD.DefaultBackgroundPressedColor}" po:Freeze="True"></SolidColorBrush>
    <!--Primary颜色-->
    <Color x:Key="WD.PrimaryNormalColor" po:Freeze="True">#B31B1B</Color>
    <SolidColorBrush x:Key="WD.PrimaryNormalSolidColorBrush" Color="{StaticResource WD.PrimaryNormalColor}" po:Freeze="True"></SolidColorBrush>
    <SolidColorBrush x:Key="WD.WindowBorderBrushSolidColorBrush" Color="{StaticResource WD.PrimaryNormalColor}" po:Freeze="True"></SolidColorBrush>

    <Color x:Key="WD.PrimaryMouseOverColor" po:Freeze="True">#BB5F5F</Color>
    <SolidColorBrush x:Key="WD.PrimaryMouseOverSolidColorBrush" Color="{StaticResource WD.PrimaryMouseOverColor}" po:Freeze="True"></SolidColorBrush>

    <Color x:Key="WD.PrimaryPressedColor" po:Freeze="True">#B70404</Color>
    <SolidColorBrush x:Key="WD.PrimaryPressedSolidColorBrush" Color="{StaticResource WD.PrimaryPressedColor}" po:Freeze="True"></SolidColorBrush>

</ResourceDictionary>
  • Import the resource file Light.Carmine.xaml to App.xaml.
  • Please fill in the path of the resource file pack://application:,,,/My project;component/Light.Carmine.xaml
 <ResourceDictionary Source="pack://application:,,,/WPFApp1;component/Light.Carmine.xaml"/>

image

Clone this wiki locally