Basically, I have a UserControl that uses a DynamicResources. The application compiles and runs fine using that resource, but it's a bit annoying to see this warning message. It makes me wonder if I'm doing it right and it's just a false positive, or if I'm doing it wrong and happen to slip through the cracks in it working.
<Grid Background="{DynamicResource AppDefaultBackgroundColor}">
...
</Grid>
So, if I used it correctly, how can I get rid of this warning message?
If I did not use it appropriately, what should it look like so I don't get a warning?
P.S. My application works and runs fine, but I prefer to not have any compilation warnings when compiling.
You can map your resource like this
<Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\Resources\Theme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Resources>
Theme.xaml must contain 'AppDefaultBackgroundColor' like this
<Color x:Key="AppDefaultBackgroundColor">#FF77C6FB</Color>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With