IT:AD:ASP.NET:Win Forms:Theming
CheckList
* THemes take precedence over local control settings *
Folders
MyWebSite
App_Themes
BlueTheme
Controls.skin
BlueTheme.css
PinkTheme
Controls.skin
PinkTheme.css
Theme
* In the .skin file, add a normal control definition by using declarative syntax, but include only the properties that you want to set for the theme. * The control definition must include the runat=“server” attribute * The control must not include the ID=“” attribute. * The control can have a SkinID
- SkinID is used to for specifically named control matching.
Programmatic Switching
Protected Sub Page_PreInit(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.PreInit
Select Case Request.QueryString("theme")
Case "Blue"
Page.Theme = "BlueTheme"
'Page.StyleSheetTheme = ...
Case "Theme2"
Page.Theme = "PinkTheme"
'Page.StyleSheetTheme = ...
End Select
End Sub
Application
<configuration>
<system.web>
<pages theme="xxx" styleSheetTheme="Themename" />
</system.web>
</configuration>
Important
There are two tags…Theme and StyleSheetTheme.
Theme has precendence over Control.
StyleSheetTheme is set first, and lets Control override it.