Friday, April 15, 2011

Getting a DynamicResource in code

hi there,

the FrameworkElement's FindResource method allows to get resources defined in this frameworkelement. however, i have some dynamic resources located in another assembly loaded at runtime. Accessing it with DynamicResource from within XAML is no problem, but i wonder how i can get access to Dynamicresources from code (e.g. datatemplateselectors). thanks

From stackoverflow
  • DynamicResource essentially defers the resolution of the resource until runtime, and creates a link between the consumer and the resource so that changes to the resource still propagate to the consumer. It still uses FindResource.

    If your external resources are merged into your visual tree you should still be able to find them with FindResource. If not, you can use pack URIs to load them manually.

    HTH, Kent

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.