How to add a theme in wpf

12,839

Solution 1

Looking at the ScreenShot of your ExpressionDark.xaml the ResourceDictionary section contains alot of xmlns tags that my version of ExpressionDark.xaml does not have, my version only includes:

<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008">

Where did you get your ExpressionDark.xaml file?

Try with this one: http://wpf.codeplex.com/downloads/get/62512

Solution 2

You can try using NuGet to install theme. From VS, go to Tools>NuGet Package Manager>Package Manager Cnsole and write the following command to install theme PM> Install-Package WPF.Themes this will make a directory in your project called Themes and download all the themes. it will also add ResourceDirectory to yourApp.xaml where you can select the desired theme. Now you just need to drag and drop the tools when you run your app you will see the theme.

Share:
12,839

Related videos on Youtube

osunwa
Author by

osunwa

Updated on September 15, 2022

Comments

  • osunwa
    osunwa over 1 year

    error I want to add expressiondark theme on WPF.

    in App.xaml:

    <Application x:Class="ThemesSample.App" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        StartupUri="MYWINDOW.xaml"> 
        <Application.Resources> 
            <ResourceDictionary Source="ExpressionDark.xaml"/> 
        </Application.Resources> 
    </Application> 
    

    in MainWindow.cs:

    public MainWindow()
    { 
        ResourceDictionary skin = new ResourceDictionary(); 
        skin.Source = new Uri(@"MYPROJECTADDR\ExpressionDark.xaml", UriKind.Absolute); 
        App.Current.Resources.MergedDictionaries.Add(skin); 
    }
    

    and added expressiondark.xaml in project. But there are errors all xmlns lines in xpressiondark.xaml.

    What is wrong?

    • Blachshma
      Blachshma over 11 years
      Did you add the ExpressionDark.xaml to the project?