1. What is the topic?
A topic consists of a group of elements: appearance, Cascading Style Sheets (CSS), images, and other resources. The topic will contain at least the appearance. The topic is defined in a special directory on a website or web server. A topic is a set of web control attributes. It provides a simple way to set the style attributes of a control.
· The topic is valid only in web control.
· The topic cannot be set on the master page, but the topic can be set on the Content Page.
· The web control style set on the topic overwrites the style set on the page
· If enabletheming = "false" is set on the page, the topic is invalid.
· To dynamically set a topic on the page, it must be before the page lifecycle page_preinit event
· Themes package. skinand. CSS files
2. What is a. Skin file?
. Skin is an appearance file that contains attribute settings for various controls (such as button, label, Textbox, or calendar control. The control appearance settings are similar to the control markup, but only include the attributes you want to set as part of the topic. For exampleButtonWidget appearance:
<Asp: button runat = "server" backcolor = "lightblue" forecolor = "black"/>
Create a. Skin file in the theme folder. A. Skin file can contain the appearance of one or more controls of one or more control types. You can define the appearance of each control in a separate file, or you can define the appearance of all themes in a file. There are two types of controls-"Default appearance" and "named appearance ":
· When a topic is applied to a page, the default appearance is automatically applied to all controls of the same type. If the widget does not have the skinid attribute, It is the default appearance. For example, if you create a default appearance for the calendar control, the display of the control applies to all the calendar controls on the page that use this topic. (The default appearance is strictly matched by the control type. Therefore, the appearance of the button control applies to all button controls, but not to linkbutton controls or controls derived from the button object .)
· The named exterior is the exterior of the control with the skinid attribute set. Named appearances are not automatically applied to controls by type. The named appearance should be explicitly applied to the control by setting the skinid attribute of the control. By creating a named appearance, you can set different appearances for different instances of the same control in the application.
3. How to define different skin for the same control
Use skinid to define different skin for the control, for example
<Asp: Label runat = server text = "themedlabel" backcolor = "red"/>-default label appearance <asp: label runat = server skinid = "boldlabel" text = "themedlabel_withskinid" backcolor = "blue" font-bold = "true"/>-label appearance named boldlabel
Therefore, no label with skinid specified on the page automatically applies the default appearance. The label skinid is set to the label control of the boldlabel to apply the boldlabel appearance.
4. How to organize theme files
The theme file can contain multiple. Skin files, so you can organize your theme files in multiple ways. All theme files will be merged before they are applied to the page.
· A. Skin file contains the appearance definitions of all controls
· One. Skin file for each control
· Place controls with the same skinid in A. Skin File
5. Is there a way to define a theme file to be shared among multiple programs?
Global themes can be referenced by any website on the server and any page on any website. Global themes can be shared among applications. For example, you want to create a globally shared theme1 topic. The global topic placement location on the IIS server is similar to "inetpub" wwwroot "aspnet_client" system_web "v2.0.xxxxx" themes "theme1
Theme1 topics at the application level cover global topics. For example, if theme1 topics are also defined in the application, theme1 topics at the application level will cover global theme1 topics.
6. What is stylesheettheme?
The topic can also include a cascading table (.css file ). When you place the. CSS file in the topic directory, the style sheet is automatically applied as a part of the topic. Use the file extension. CSS to define a style sheet in the theme folder. Set the stylesheettheme attribute of the page to apply the topic as the style sheet topic. If you want to be able to set the attributes of each control on the page and still apply themes to the overall appearance, you can apply themes as style sheet themes. If enabletheming = "false", stylesheettheme is still valid. Modify the theme style on the page dynamically by overwriting the attribute stylesheettheme.
Public override string stylesheettheme
{
Get {retrun "mystylesheettheme ";}
}
7. Theme/Skin Resources
A set of quite good theme that can be directly used for project development
Theme preview:Http://www.dotnettreats.com/SampleThemes/Default.aspx
Theme download:Http://www.dotnettreats.com/tools/Default.aspx