I get confused with Windows 8, as I get used to access a template that i had defined in page like this :
FrameworkElement element = container as FrameworkElement;
DataTemplate myTemplate = element.FindResource("myTemplate") as DataTemplate;
The problem is that in Windows 8 the FindResource method doesn’t seem to exist anymore. I try to access the Resource Dictionnary but without any success.
Do you have any idea, or Should the previous example work?
Thank you
FrameworkElement has a Resources property that you can access through it’s indexer like so:
This property is only populated with the resources defined on that element and is not the full collection of resources in the Application. So whether that template will be found depends on where you’ve defined in.
You can find the resources defined in App.xaml (as well as it’s merged resource dictionaries) like so: