Why am I not able to use FindResource() in Windows phone programming?
c#, windows-phone-8, xaml
Solution
If your style is defined in `Resources` of the App.xaml, you have to use:
play_btn.Style = App.Current.Resources["btnplay"] as Style;
otherwise (e.g. MainPage.xaml, SecondPage.xaml ...):
play_btn.Style = this.Resources["btnplay"] as Style;
Or you can implement `TryFindResource` as extension method: "How to implement the missing TryFindResource".
Problem
I want to use `FindResource()` in C# Windows phone programming to change the style of a control, but I am not able to. `play_btn.Style = FindResource("btnplay") as Style;` This gives an error: does not exist in the current context.