Background stays white?

Feb 22, 2010 at 2:44 PM

Hi all,

I'm trying to get going using the WPF Themes by just adding

    <Application.Resources>
        <ResourceDictionary Source="ExpressionDark.xaml"/>
    </Application.Resources>

to App.xaml like it says here. Now, my controls have the theme applied, accept for the background, which stays white.

Any ideas?

Thanks!

Stefan

Feb 22, 2010 at 2:53 PM
Edited Feb 22, 2010 at 2:55 PM

The way I achieved it was to add a syle for the window to the xaml file, for example...

<Style x:Key="WindowStyle" TargetType="{x:Type Window}">
        <Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}"/>
    </Style>

then in my window1.xaml I set the style attribute of the container Window.

<Window x:Class=YourClass"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="768" Width="1024"
    Style="{DynamicResource WindowStyle}">

 

EDIT: Actually I am loading the theme at run time, thats why I need the Style="{DynamicResource WindowStyle}" you will probably not need this.

Feb 22, 2010 at 3:07 PM

Looked at the source to find the Demo project there, so I'm now looking at that.

An apparent reason for the background to stay white, would be that the solidcolorbrush for windowbackground contains color="#FFF", but there seems more to it than just that (BureauBlack Theme in this case).

Thanks for your sample BTW.

Stefan