I am sure that it’s a rather trivial solution, but I can’t seem to be able to find it.
I have a WPF application running on .NET 4.0. In this application, I need to access, from the XAML code, a string resource I defined in my resource.resx file. I added the application.properties namespace to xaml, but when I try to link to any property of the Resources class, VS complains that the Type is not found.
Here is my code:
<Window x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prop="clr-namespace:MyApp.Properties"
Title="MyApp" Height="200" Width="525" >
<Grid>
<Label Content="{x:Static prop:Resources.string}" Height="28" HorizontalAlignment="Left" Name="labelStringName" VerticalAlignment="Center" />
</Grid>
</Window>
The exact error message is
Error 3 Type ‘prop:Resource’ was not found. c:\users\me\documents\visual studio 2010\Projects\MyApp\MyApp\MainWindow.xaml 3 44 MyApp
I forced a build and the designer updated itself. Seems like it was only a designer bug.