WPF Window Style not working at runtime

Posted by Christian Pena on Stack Overflow See other posts from Stack Overflow or by Christian Pena
Published on 2010-04-15T01:41:07Z Indexed on 2010/04/15 1:43 UTC
Read the original article Hit count: 1263

Filed under:
|
|

Hi,

I created a WPF application in Visual Studio 2010 Express (C#) and added the text below to the Application.Resources in App.xaml. I see the style applied to the window in the designer, but when I run the application, the window background is white.

Running in Windows XP on BootCamp on a MacBook Pro if that is a factor.

Thanks in advance,

Christian

    <Style TargetType="{x:Type Window}">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0" Color="WhiteSmoke" />
                    <GradientStop Offset="1" Color="Silver" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>

        <Setter Property="Padding" Value="20" />
    </Style>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpf-styles