Forum Cross Platform with Xamarin

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Access to the Application.Current.Resources on WinPhone 8.1 and Windows 8.1

Hi,

I want to change some colors in WinPhone 8.1 and Windows 8.1 applications. For example, I want to change Accent color, or Selection color, or Entry text color. As I know it is possible to set color or brush via Application.Current.Resources dictionary:

(Application.Current.Resources["BackgroundBrush"] as SolidColorBrush).Color = Colors.Orange;
as it mentioned in the following articles:
http://stackoverflow.com/questions/17582998/windows-phone-8-how-to-be-always-on-one-theme-even-if-phones-theme-changed
http://stackoverflow.com/questions/19272265/how-to-force-windows-phone-8-app-to-be-run-in-light-theme

But when I try to access to the Application.Current.Resources in my App.xaml.cs class constructor I get an exception:

System.Exception was unhandled by user code
HResult=-2147418113
Message=Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
Source=Windows.UI.Xaml
StackTrace:
at Windows.UI.Xaml.Application.get_Resources()
at KC.Mobility.Technician.Win.App..ctor()
at KC.Mobility.Technician.Win.Program.<>c.

b__0_0(ApplicationInitializationCallbackParams p)
InnerException:

How can I set some specific brushed or colors in the default theme for the whole application?

Best Regards,
Aleksandrs

Sign In or Register to comment.