Open ivanfong01 opened 11 years ago
Can you provide more information? Since the phone only supports static resources, technically this script updates the Color values (replacements) within the Brush but the brushes will not be resolved again by UI elements already in the tree. This is a limitation of the phone XAML stack.
On Sun, Apr 28, 2013 at 10:30 AM, ivanfong01 notifications@github.comwrote:
When I try to get the current PhoneBackgroundColor/PhoneForegroundColor etc. from Application.Current.Resources, it always return the phone original theme background color but not the theme I forced using theme manager
— Reply to this email directly or view it on GitHubhttps://github.com/jeffwilcox/wp-thememanager/issues/9 .
Hi Jeff,
I'm having the same issue as ivanfong01. Take the following scenario :+1:
Do you know why this is happening?
Well everything will often be cached, so older pages will not get updated, etc. The best experience will be to set this at startup and then require a restart of the app if they want to change the theme.
At line 525 you wrote
currentColor = (Color)Application.Current.Resources[prefix + "Color"];
But Color
is a struct(Color Structure (System.Windows.Media)) so trying to get currentColor
will only get a copy and will not affect the original value.
You must remove the value first if it exists then add new value.
// Check if the Color is actually in the dictionary
if (Application.Current.Resources.Contains(prefix + "Color"))
Application.Current.Resources.Remove(prefix + "Color");
Application.Current.Resources.Add(prefix + "Color", color);
At least up through Windows Phone 7.5, the managed layer is only a representation, but the underlying native code calls actually hit the actual graphic cache. At least back when the code was first written, removing and adding would actually do nothing - but this might have changed in 8.0+.
Happy to accept a contribution if you have a legit fix since the NuGet package now only targets Windows Phone 8+.
When I try to get the current PhoneBackgroundColor/PhoneForegroundColor etc. from Application.Current.Resources, it always return the phone original theme background color but not the theme I forced using theme manager
(I am using WP8)