Click here to Skip to main content
15,881,424 members
Articles / Programming Languages / C#

Silverlight Dynamic Themes

Rate me:
Please Sign up or sign in to vote.
4.92/5 (11 votes)
6 Jan 2012CPOL6 min read 56.5K   5.9K   29  
This article describes how to dynamically apply themes to a Silverlight application.
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  xmlns:dataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
  xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"  
  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:appControls="clr-namespace:SLDynamicThemes2.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SLDynamicThemes2;component/Assets/Themes/Windows7/Brushes.xaml" />
        <ResourceDictionary Source="/SLDynamicThemes2;component/Assets/Themes/Windows7/Fonts.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="appControls:PageBackground">
        <Setter Property="Background">
            <Setter.Value>
                <RadialGradientBrush Center="0.492,0.068" GradientOrigin="0.492,0.068" RadiusX="0.556" RadiusY="0.734">
                    <GradientStop Color="#FF606060" Offset="1"/>
                    <GradientStop Color="#FF404040"/>
                </RadialGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Romania Romania
I have been a software developer for a while and still find this an interesting job.

Comments and Discussions