What is a StyleSheetTheme?
Basically StyleSheetTheme is a Theme which gets applied in very early page cycle before the page control properties applied.
So order is like StyleSheetTheme -> Page -> Theme
That means control property set in StyleSheetTheme can be overridden by the control property in Page and control property set in Page can be overridden by the control property in Theme.
That means control property set in StyleSheetTheme can be overridden by the control property in Page and control property set in Page can be overridden by the control property in Theme.
For example if StyleSheetTheme contain following default Label skin.
<asp:Label runat="server" Text="StyleSheetLabel" Font-Size="Small" BackColor="Red" ></asp:Label>
<asp:Label runat="server" Text="StyleSheetLabel" Font-Size="Small" BackColor="Red" ></asp:Label>
and Page Which has StyleSheetTheme and Theme defiened contain a Label contol as
<asp:Label runat="server" Text="PageLabel" Font-Size="X-Large"
></asp:Label>
<asp:Label runat="server" Text="PageLabel" Font-Size="X-Large"
></asp:Label>
and Theme contain following default label skin.
<asp:Label runat="server" Text="ThemedLabel" ></asp:Label>
<asp:Label runat="server" Text="ThemedLabel" ></asp:Label>
Then the resultant Label shown will look like.
<asp:Label runat="server" Text="ThemedLabel" Font-Size="X-Large"
BackColor="Red" ></asp:Label>
<asp:Label runat="server" Text="ThemedLabel" Font-Size="X-Large"
BackColor="Red" ></asp:Label>
Above example is just to show the precedence heirarchy but generally either StyleSheetTheme
or Theme will be applied to the page and not both.
StyleSheetTheme has same characteristics Theme except few differences.
or Theme will be applied to the page and not both.
StyleSheetTheme has same characteristics Theme except few differences.
- StyleSheetTheme works in Designer
- To apply StyleSheetTheme at Site Level define following in web.config
<system.web>
<pages styleSheetTheme="Theme1" />
<system.web>
- To apply StyleSheetTheme at Page Level
<%@ Page Language="C#" StylesheetTheme="Theme1"%> - To apply StyleSheetTheme dynamically user need to override the StyleSheetTheme property.
public override string StyleSheetTheme
{
get{ retrun "MyStyleSheetTheme"; }
}
- To apply a StyleSheetTheme to a control added dynemically user need to call ApplyStyleSheetTheme(Page) method on the control.
Label lab1 = new Label();
lab1.ApplyStyleSheetSkin(this); - EnableThemeing doesnt work with StyleSheetTheme. Setting EnableTheming="false" doesnt stop applying StyelSheetTheme to the page or control.
·Can not apply SkinId dynemically.
http://weblogs.asp.net/vimodi/articles/WhatIs_StyleSheetTheme.aspx
No comments:
Post a Comment