Friday, March 16, 2012

Assigning a dynamic resource link programmatically

In XAML, you can specify whether a resource is static resource or dynamic by using the StaticResource and DynamicResource with binding. Also if you want to do this thing pro grammatically (in C#) then static behavior is simple. You just need to find the resource using TryFindResource() method and set the desired property of it. But if you want to have it dynamically updated then use SetResourceReference() method.

Syntax:
frameworkElement.SetResourceReference( dependencyProperty, resourceKey );

Interesting. 

No comments:

Post a Comment