Merged Dictionaries in the App.xaml

At first, my window1.xaml displays fine in the designer.

In Application.xaml, I add a ResourceDictionary.

Code Snippet

<!-- change this comment to fix designer -->

<Application.Resources>

<ResourceDictionary>

<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="themes/test.aero.normalcolor.xaml"/>

</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

</Application.Resources>

After I build (or rebuild), the Design tab of Window1.xaml displays Whoops, and the following error is listed:

Value 'themes/test.aero.normalcolor.xaml' cannot be assigned to property 'Source'. ResourceDictionary LoadFrom operation failed with URI 'winfxprojectresource:///C:/Documents and Settings/Andrew/My Documents/Workstation/themes/test.aero.normalcolor.xaml?5/11/2007 4:46:20 PM;themes/test.aero.normalcolor.xaml'.

If I change anything about the application.xaml file , even just the comment, then Window1.xaml will redisplay in the Design tab. But every time i rebuild, the same Whoops reappears.

Any ideas?

Andrew

btw:

I am using C# Orcas beta 1

I have checked out all the "Load limitations" at the Cider Wiki.

[3212 byte] By [awcullen] at [2008-1-6]
# 1
Is themes/test.aero.normalcolor.xaml in your project?
MarkBoulter at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 2

If you converted your project from VS2005 to Orcas, you'll find that the Custom Tool property for the Application.xaml file is not set but it needs to be. Orcas apparently uses this custom tool attribute to manage files at design time but I don't know the specifics. In any case, select your Application.xaml file and in the properties panel, set the Custom Tool property to MSBuild:Compile. This should solve your problem.

Note 1: I believe you need to set this property on all .XAML files in your project or you'll be missing intellisense in codebehind, etc. until the project is built...

Note 2: If you create a new WPF Application in Orcas, you'll see that this property is already set for you on XAML files.

TonyB at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 3
FYI - we have fixed this issue in the (almost) Beta2 builds of Orcas - mark
MarkBoulter at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 4

By chance, is there a clever work-around for Orcas Beta 1 (other than punting on MergedDictionaries altogether and copying the styles into app.xaml)? It is pretty annoying, since it effectively breaks the VS WPF Designer tool...

ehahn9 at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 5

I agree...very frustrating to use!

I dont really have a reliable workaround other than that sometimes closing the design view and re-opening it seems to load the xaml successfully.

Craigomatic at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 6

I've downloaded one of the examples from the web, Family.show, and I've tried to play with it in Orcas beta 1. I can't get any of the CIDR pages to load. I've been having pretty much the same issues as the origional post. I've added the MSBuild:Compile to all XAML pages, but it doesn't seem to work. I see that creating a new project sets the property correctly, but is there a way to make a converted project work? Thanks in advance.

JonathanHaun at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 7
I'm also seeing this problem. My App.xaml looks like this:

<Application x:Class="MyApp"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Startup="AppStartup"

Exit="AppExit">

<Application.Resources>

<ResourceDictionary>

<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="Resources\AppStyles.xaml"/>

<ResourceDictionary Source="Resources\SimpleStyles.xaml"/>

<ResourceDictionary Source="Resources\Shared.xaml" />

<ResourceDictionary Source="Resources\ScrollBar.xaml" />

<ResourceDictionary Source="Resources\ResizeGrip.xaml" />

</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

</Application.Resources>

</Application>

Visual Studio won't open any of my controls in the designer, giving me the warning:

Error 1 Value 'Resources\AppStyles.xaml' cannot be assigned to property 'Source'. C:\MyApp\App.xaml 12 31 MyApp

Note that this doesn't effect compilation -- just the designer. Does anyone have a workaround?

Many thanks.

Drew.

DrewNoakes at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...
# 8
Is this on Beta1 or Beta2?

MarkBoulter at 2007-9-28 > top of Msdn Tech,Visual Studio Orcas,WPF Designer (Cider)...

Visual Studio Orcas

Site Classified