Can't resolve default StaticResources

Apr 23, 2013 at 10:38 AM
I facing problems to resolve StaticResources like
Style="{StaticResource Heading2}"
or
Style="{StaticResource ContentRoot}"
It says: "Resource 'ContentRoot' is not found.

Image

My App.axml looks like this:
    <Application.Resources>
        <ResourceDictionary>
            <Style TargetType="{x:Type Rectangle}"/>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.xaml" />
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.Light.xaml"/>
                <ResourceDictionary>
                    <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
I'm also missing some of the styles (e.g. for Label)

Any ideas?
Coordinator
Apr 23, 2013 at 9:46 PM
Does it compile and run properly? This might be a designer-only issue.

There's no mui style (yet) for the Label control.
Apr 24, 2013 at 10:27 AM
Looks like an designer-only issue. Any ideas how to fix it?

Thank you
Coordinator
Apr 24, 2013 at 7:29 PM
Not sure yet. What version of VS or you using?
Apr 25, 2013 at 7:36 AM
Microsoft Visual Studio Premium 2012
Version 11.0.60315.01 Update 2
Microsoft .NET Framework
Version 4.5.50709
Apr 25, 2013 at 7:52 AM
The problem exists even when i create a new visual studio solution + project. I used the "Modern UI WPF Application" project template.
Coordinator
Apr 27, 2013 at 5:39 PM
The problem is in WPF 4.0. The workaround for resolving resources at runtime apparently does not work at design-time. The issue does not occur when targetting WPF 4.5. Not sure if anything can be done about it.
Coordinator
Apr 27, 2013 at 5:53 PM
I take that back, it seems to work fine for WPF 4.0 projects. I'm using Visual Studio 2012 Ultimate, no 3rd party tools (such as resharper)
Apr 29, 2013 at 10:07 AM
The issue seems to be related to the "Modern UI WPF Application" project template. The problem occurs when i use this template. The problem does not occur in your demo application (FirstFloor.ModernUI.App).
Coordinator
Apr 30, 2013 at 9:36 PM
Are the resource dictionaries in your app.xaml properly resolved? Any curly underlines when you open app.xaml in the editor?
May 2, 2013 at 8:03 AM
no, the app.xaml looks good:
App.xaml
Coordinator
May 2, 2013 at 12:47 PM
And this is a WPF 4.5 project?
May 2, 2013 at 1:26 PM
Edited May 2, 2013 at 1:29 PM
Yes it is! I just thought that the Rectangle Hack would solve the problem.
Coordinator
May 2, 2013 at 1:30 PM
Edited May 2, 2013 at 1:30 PM
Then something else is going on, the rectangle hack is not required for 4.5. You seem to be using resharper or something similar, what if you disable this tool in VS?
May 2, 2013 at 1:35 PM
i created an fresh emtpy m:ui project, could you check if you get curly underlines on your machine?

I will check if it works without resharper etc.
Coordinator
May 2, 2013 at 1:43 PM
Yep, works fine.

Image
May 2, 2013 at 2:03 PM
therefore, the issue must be related to my machine or to the installation of M:UI on my machine.
Oct 16, 2013 at 2:18 PM
Edited Oct 16, 2013 at 2:18 PM
Weird. I am having the same issue on my machine (VS2012 + Resharper). It works fine when I run it but it's failing to build in TeamCity. Ill keep investigating...

I am running a program created via the MUI template in VS.
Oct 17, 2013 at 7:32 AM
killnine wrote:
Weird. I am having the same issue on my machine (VS2012 + Resharper). It works fine when I run it but it's failing to build in TeamCity. Ill keep investigating...

I am running a program created via the MUI template in VS.
Try to remove it from resharper error/warning.
Resharper can force a simple warning to an error if a wrong setting is set.
Nov 28, 2014 at 8:30 AM
Someone fixed this issue?