How to reload system default resources in Windows Phone 8.1

Source: Internet
Author: User



In the application design process, we always design the layout and color allocation of the application blocks. Of course it's just our wishful thinking, when we really start



CD, this only to find that the expectations are always very good, practical operation is indeed a bit difficult. Of course, for seasoned programmers, this is a hindrance



Is nothing.



As the topic says, Microsoft has given us a variety of system default resources, especially for the control of some properties, sometimes we can



Directly defining attributes to overwrite them, and sometimes we define properties that are still useless, and at this point we need to reload its default theme values.






All right, here's a bunch of crap, let's see how many default theme resources are available:



Take ProgressBar as an example, because for this control, your wishful setting of its foreground and background values doesn't seem to be



Use, it is still it, and will not be so good to listen to your orders.



First bring up the foreground property in the ProgressBar Settings tab, click on its settings option, and then you will see that it provides you with a variety of settings



method, here we move the mouse over the system resources.








You will find that you will jump out of a lot of system definition resources, scroll up and down to see, obediently, really is quite a lot of. So in the future, if you don't know the system resources



Define the key value, you can do so.






knowing the system default resources and how to view them, the next step is to reload it. Here is still the example of taking the ProgressBar control .



I'm going to set ProgressBar's foreground to green, and this way I'm going to reload the system default theme resource is



Progressbarindeterminateforegroundthemebrush this system resource. Of course if you don't know exactly which one, for this control



The system default resource definition is not many, you can try one at a, do not go to MSDN to find out exactly which one is OK.



Step One:



Create a new resource dictionary in your project and reload the theme resources as follows:

<ResourceDictionary
    xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns: local = "using: RedefineProgressBarColor">
    
    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x: Key = "Default">
            <x: String x: Key = "ProgressBarIndeterminateForegroundThemeBrush"> Green </ x: String>
        </ ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>
    
</ ResourceDictionary>

Step two:
Then include this resource dictionary in App.xaml as follows:


<Application
    x: Class = "RedefineProgressBarColor.App"
    xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns: local = "using: RedefineProgressBarColor">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source = "RedefineDictionary.xaml"> </ ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ ResourceDictionary>
    </Application.Resources>
    
</ Application>

Step three:
Drag in a ProgressBar control on the page and run it to find that its Foreground becomes the Green you set, but if you do n’t

With this system resource attribute, the default value of Foreground is not necessarily Green. And if you do n’t reload, just set its Foreground repeatedly

Value, then it will ignore you and still display the system's default resource attributes.



The above is the main content of this blog. Three points should be added here:

1. For the above statement, some people may have some questions. What is the color of the default theme of the system? Very good

Look, the Foreground color (foreground color) is the same as the theme color set on your phone, and for many other controls, many problems are caused by this

Mobile phone theme color above. So our mobile phone theme color is the default theme color, and because everyone ’s habits of using mobile phones are different, so in order to apply

The unity of this requires us to set ourselves.

The details are as follows:

              


2. The above declaration and binding settings for style resources are just one of the methods, and there are many other methods. The style property settings in this blog are

Supplement to a previous blog.

Previous blog: Three, four methods for generating button and button background images in win8 and win8.1 applications and four methods for changing element styles


3. I haven't set the Background of ProgressBar here. At first, you can try it by yourself, one by one; the second, I think it is unnecessary, because

It should be transparent itself, if it is to be set, it will highlight the color, no aesthetic sense.
How to reload the system default resources in Windows Phone 8.1

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.