Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Access Resource from dynamically built ResourceDictionary in code behind!

$
0
0

Hi Everyone,

I have built a ResourceDictionary in code:

like this

It works fine for binding in xaml etc, but if I try to access the resource in code like:

string xyz = Resources.FindName("XYZ_Key").ToString();

I get error. The key is not found.

In the Resource.XAML file I will have something like:

 <s:String x:Key="XYZ_Key">XYZ</s:String>

How can I access the resource so that I can get the value?



Please Mark as Answered If this answers your question OrUnMark as Answered if it did not.
Happy to Help :)
My Site


Viewing all articles
Browse latest Browse all 18858

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>