UIComposition EmployeeDetailsView can't design

Sep 14, 2008 at 1:18 PM
Edited Sep 14, 2008 at 1:19 PM
Can I get a sanity check from someone... I can't load EmployeeDetailsView into the designer (straight out of the box) because I get errors.
The whole solution compiles and builds and runs, but I can't load this view.
I get the error: "Specified method is not supported".

As a WPF newbie, I have to ask, is this some quirk of the way this particular XAML is constructed - or is likely something specific to my machine?
Sep 17, 2008 at 7:40 PM
Edited Sep 18, 2008 at 11:42 PM
A few steps will fix you up.

In your UIComposition project go to the Styles folder, right click on Styles.xaml and select "Copy" (we're copying the full path)

In your UIComposition.Modules.Employee project
  1. Add a Styles folder
  2. Right-click "Styles" folder and click "Add Existing Item"
  3. Paste the path into the "Object Name:" block
  4. DO NOT CLICK ADD.  Instead on the dropdown triangle to the right of "Add" select "Add as Link" (this way you won't have two files to maintain)
  5. Add the <UserControl.Resources> information from below into your EmployeesDetailsView XAML file as shown:

<UserControl x:Class="UIComposition.Modules.Employee.EmployeesDetailsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:UIComposition.Modules.Employee"
    xmlns:cal="http://www.codeplex.com/CompositeWPF">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Styles\styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

You should be able to compile and view EmployeesDetailsView.xaml in the designer.

As a WPF newbie I would strongly recommend Adam Nathan's book WPF Unleased - I was a newbie not to long ago (still qualify as one ;)

Oct 8, 2009 at 7:29 PM

I followed this guidance and while I can now view the xaml in the designer, when I run it I get an XMLParseException because it cannot locate resouce "styles/styles.xaml".