views:

201

answers:

2
+2  Q: 

WPF Custom Themes

Hi, I have a simple question which is giving me some difficulty. I have downloaded a custom them for WPF of the net. Now i want to apply this theme to my App instead of the default one.

How do i do that, Do i do it in XAML or in Code ?

Thanks Iffy

+1  A: 

Add namesapce of your theme:

xmlns:expDark="clr-namespace:System.Windows.Controls.Theming; assembly=System.Windows.Controls.Theming.ExpressionDark"

xmlns:theming="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.Toolkit"

And wrap your controls with theme in XAML.

<!-- expDark:ExpressionDarkTheme is theme what I want to apply-->
<expDark:ExpressionDarkTheme>
  <Button Content="Счастье" Width="200" Height="50"
  FontSize="26" Margin="10"></Button>
</expDark:ExpressionDarkTheme>
bniwredyc
So i have to wrap every control for my theme to work. Also my theme is an XAML file so it has no namespace, what would i reference?ThanksIffy
Iffy
+3  A: 

I just came across something that answered my problem in one. I used the line

<ResourceDictionary Source="Themes/ExpressionDark.xaml"/>

This i put into my Windows resources inside a merged dictionary. What this did was apply my theme to the window as a default theme. Easy and quick.

Hope this helps others in future.

Thanks Iffy.

Iffy