This problem is mainly bother some as Visual Studio IDE is telling me that it cant find the resource, but when I build the application I am not having any problem.
In my Visual Studio i have this:
Here is an example of my Universal App architecture is as Follows:
Example.windowsPhone
->MainPage.xaml
Example.Share
-> Style.xaml
-> App.Xaml has Style.xaml referenced
Eventhought i have reference DmBlueBrush in my Style Page like this :
<SolidColorBrush x:Key="DmBlueBrush" Color="{StaticResource DmBlue}" />
In Visual Studio it will tell me that it cant find it, but when I build the application it will find this resource. Have I not reference something correctly for my IDE to work?
I am using Visual Studio 2013 Professional Version 12.0.31101.00 Update 4.
Edit 1:
in App.xaml in Shared i Have:
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Theme/Styles.xaml"/>
<ResourceDictionary Source="Theme/Other.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Did you link your Resource Dictionary?
Right click Shared Project > Add > New Item > Resource Dictionary
For this example, named it MyStyles.xaml
Then in App.xaml link by
<Application
x:Class="YOUR_CLASS.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:YOUR_CLASS">
<Application.Resources>
<ResourceDictionary Source="MyStyles.xaml"></ResourceDictionary>
</Application.Resources>
</Application>
example MyStyles.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:YOUR_CLASS">
<SolidColorBrush x:Key="MyGreen" Color="Green"/>
</ResourceDictionary>
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