Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've written and debuged a code below:</p> <pre><code> private void myButton_Click(object sender, RoutedEventArgs e) { Color myColor = (Color)App.Current.Resources["PhoneAccentColor"]; App.Current.Resources.Remove("PhoneAccentColor"); bool contains = App.Current.Resources.Contains("PhoneAccentColor"); App.Current.Resources.Add("PhoneAccentColor", Colors.Brown); Color myCol = (Color)App.Current.Resources["PhoneAccentColor"]; // Below works LayoutRoot.Background = new SolidColorBrush((Color)App.Current.Resources["PhoneAccentColor"]); // Not working as you have to change Brush separately LayoutRoot.Background = (Brush)App.Current.Resources["PhoneAccentBrush"]; // Now working App.Current.Resources.Add("PhoneAccentBrush", new SolidColorBrush(Colors.Cyan)); LayoutRoot.Background = (Brush)App.Current.Resources["PhoneAccentBrush"]; return; } </code></pre> <p><strong>EDIT</strong><BR> It's working properly - but it's not the Resource you were looking for - it's just creating 'local' Resource which doesn't affect the 'real' PhoneAccentBrush - if you create new Page with Background from StaticResource it will have the default PhoneAccentBrush.<BR> But what I managed to do:</p> <pre><code> private void myButton_Click(object sender, RoutedEventArgs e) { Color myColor = (Color)App.Current.Resources["PhoneAccentColor"]; myColor.A = 255; myColor.B = 75; myColor.G = 150; myColor.R = 150; SolidColorBrush internalBrush = (SolidColorBrush)App.Current.Resources["PhoneAccentBrush"]; internalBrush.Color = myColor; return; } </code></pre> <p>You cannot remove or override PhoneAccentBrush, but 'locally' (for your App) you can change it's properties. It works quite fine - after this Clisk event, when I create new Page, the PhoneAccentBrush is just as I've set it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload