I’m trying to load a ResourceDictionary object into code so that I can check if it contains a certain value before trying to bind to it, but for some reason it can’t find the resource. It might be something basic, ie having the wrong build action or URI but can someone point me in the right direction?
The .cs file and the Images.xaml resource dictionary are both in the same folder and namespace
This is the code that is failing
ResourceDictionary resourceDictionary = new ResourceDictionary();
resourceDictionary.Source = new Uri("Images.xaml", UriKind.Relative);
Any idea what I’m doing wrong? getting error message
{“Cannot locate resource ‘images.xaml’.”}
The XAML parser probably adds an
applicationauthority when converting URIs, in code you may need to add that yourself. Build action should just be the default forResourceDictionaries, whatever that may be.