How to modify a system-defined resource color in Windows phone

Source: Internet
Author: User

"The background of the problem"

I believe that some of the experience of WP research and development students will encounter the following problems:

The Phoneaccentbrush brush (which defines the system's accent color, the user's chosen theme color) is heavily used in system controls and Wptoolkit.

In order to meet the requirements of the UI design, there are no more than 100 lines of XAML code defined for a color value, only one row is used to modify the color.

2, the use of TextBlock forget the setting foreground cause users to switch to the theme of white, a lot of words can not see clearly.

The following is an excerpt from the definition of the control template in Wptoolkit:

It's a good thing to do this, but here's how it can be sprayed directly:

"Solution"

Previously, I used blend edit Template copy to achieve the requirements (gorgeous display of a good XAML base =. =), know one day suddenly thought, we can change the system this resource ...

The author made several attempts, and finally solved the problem with the following code:

MainColor1 and Defaulitforegroundcolor are a color type of resource that I define in the program resource dictionary:

All we have to do is put the overwritesystemcolor on the last side of the app's constructor.

Such a tricky way then steal moved to modify the system defined color value, save a lot of things that have been very troublesome before!

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Related Article

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.