Geeks With Blogs


What I do:

Identity Mine

MVVM Light


What I am:

Microsoft Most Valuable Professional, Client Application Development

Microsoft Certified Technology Specialist, Windows Presentation Foundation

WPF disciples


View my profile on LinkedIn

Creative Commons License
Diary of a Code Trotter by Laurent Bugnion is licensed under a Creative Commons Attribution 3.0 Unported License

All source code on this blog is licensed under the MIT license.

Copyright (c) 2006 - 2011 GalaSoft Laurent Bugnion

Laurent Bugnion (GalaSoft) Diary of a Code Trotter

Following a past entry about Blend and external resources, some of you told me that they tried it without success in Orcas. Here is an updated checklist for Orcas, which should solve the problem, I hope.

To make things clear: I use the latest version of Expression Blend (at the time of this writing, it's the August CTP of Blend 2). With earlier versions of Blend, it probably won't work as well, if at all.

Additionally, it is imperative to use the syntax I describe to "merge" the resource dictionary in the Window. To provide you with a good basis, I also saved a Visual Studio 2005 and a Visual Studio 2008 project on my webserver. Opening these projects in Blend should allow saving resources to external resources in the way I describe.

  • Create a new WPF application in Visual Studio 2008
    "File / New / Project / Windows / WPF Application". Name the project "MyApplication"
  • In the Solution Explorer, right-click on the solution and select "Add / New project / WPF User Control Library". Name this project "Skins".
  • Select the UserControl1.xaml and delete it. This deletes both the XAML file and the C# file (code-behind).
  • Right-click on the Skins project and select "Add / New item / Resource Dictionary (WPF)". Keep the name Dictionary1.xaml.
  • Right click on the project MyApplication and select "Add reference / (wait, wait) / Projects / Skins". This creates a one-direction link between the Skins project and the MyApplication project.
  • Open the file Window1.xaml in the MyApplication project. Modify the XAML code to look this way:
Title="Window1" Height="300" Width="300"

<ResourceDictionary Source="/Skins;component/Dictionary1.xaml"/>


This imports the resources defined in Dictionary1.xaml, in the external assembly, so that they will be parsed and made available to your controls.

  • Save everything, Build once to create the assemblies.

Now we will change to Expression Blend 2 and store a resource in the external Dictionary1.xaml

  • Open the solution in Expression Blend 2.
  • Open the file Window1.xaml.
  • Add a Button to the Window using the toolbar on the left
Toolbox, insert a button
  • Make sure that the Selection tool is selected in the toolbox. Right-click on the button and select "Edit Control Parts (Template) / Create Empty".
  • This opens a dialog. Note how you can choose to store the new template in the resource dictionary "Dictionary1.xaml" even though it is located in an external assembly.
Create resource dialog
Posted on Monday, August 20, 2007 3:19 PM Technical stuff , .NET , WPF , Expression Blend | Back to top

Comments on this post: WPF: Expression Blend 2 and external resources (VS2008 version)

Comments are closed.
Comments have been closed on this topic.
Copyright © Laurent Bugnion | Powered by: