Luca Lindholm
Luca Lindholm

Reputation: 821

Get a XAML resource from code in a UWP Class Library

Hi everyone and Merry Chrismas.

I already know how to get a XAML resource in a main UWP project, but is it possible to get a ResourceDictionary's XAML resource from a class, both contained in a UWP Class Library?

Thanks for your attention.

Upvotes: 0

Views: 289

Answers (1)

walterlv
walterlv

Reputation: 2376

Just call this line in your C# code:

Application.Current.Resources["Key"]

And you'll get the resource named "Key".

If you cannot compile this method in your class library, it may be that your class library is not designed especially for UWP, so you can't try to get a resource there.

Upvotes: 3

Related Questions