Discover innovative solutions, best practices, and cutting-edge technologies in enterprise architecture
Monday, April 19, 2010
[WPF] How to assign a dynamic resource from code-behind ?
When working on WPF projects, it’s mandatory to assign resources to user interface controls. When you work in XAML, it’s pretty simple: you just need to use the MarkupExtension named StaticResource (or DynamicResource if the resource is going to be modified):
As you can see, it’s really simple to use: you define the resource, you define the control and, in code behind, you call the method SetResourceReference and use the following parameters:
the DependencyProperty on which the resource will be applied
No comments:
Post a Comment