VS2005 BETA2 Experience: Using Themes (Themes)

Source: Internet
Author: User
Tags modify
The theme (Themes) allows you to maintain a unified style of your site. Of course, you can also specify different theme for individual pages or controls. Think about it, modify the entire site style, only need to modify the theme file can be done, that is how pleasant thing ah. ^_^

If you don't say much, test your test with a simple button Theme, and note that this is a custom theme (named Theme). Choose to add new items, select skin files, click Add, if there is no App_Themes folder under the site, there will be prompts. As shown: Click Yes, folders and files are created. Open skin file, add the following code in the file : Inside the parameters are well understood, the inside of the SkinID is a logo, control use when you need to choose this id,backcolor= "white" is to identify when a control uses this SkinID, the control's BackColor is white. Just such a simple theme is done. Next, make a page that calls this theme.

Create a new page useskinpage.aspx, add a Server button to the page, select the button's properties, and notice the two items: EnableTheming and SkinID. You need to set true if you want the control to use Themes,enabletheming.  SkinID good understanding, is skin file inside a SkinID, such as the buttonSkin1 above. Before that, you need to set the Theme property in page, otherwise the page can not find the path of skin file, of course, will not be used theme. When the correct theme file is set, the SkinID item in the Button property will be able to respond to the content so that you choose, of course, on this page is buttonSkin1. The main code inside the Useskinpage is as follows:

When you visit, you can see that the button's background is set to white. In the skin file, for the same type of control, you can have multiple SkinID, in the page, choose a different skinid on it.

If you want to apply a theme to the entire site, you can add it in the Web.config file , so you don't have to use theme= "themename" tags in each page. In this example, the use of .

Another way to use a theme is to use StyleSheetTheme. StyleSheetTheme and Customtheme files are the same, the contents can be kept the same, but in the call when there are some differences.

Other: 1. App_Themes directory can have more than one themes, when used, in the inside choose which one to use. 2. When writing skin code, VS2005 does not automatically verify the ID number of the control, as it does on the page, and SkinID will not automatically verify the error when compiling. 3. You can use other control types of SkinID, for example, button using the skin of the textbox, the compilation will not be wrong, but browsing the page is not effective. There is no error when the SkinID that is used does not exist. 4. The theme priority is as follows: Themes > Local css > StyleSheetTheme, so if there are two identical skinid in Themes and StyleSheetTheme, the page will choose Themes instead of Styleshee Ttheme's

Probably used a bit, the specific content of their own hands to try to know. Next time ............... ..........



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.