5

I just got VS2013 and opened my VS2010 project. However now I cannot see any of xaml designs. The problem is the Styles are not being applied:

   <UserControl.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Themes/Colors.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>

Gives me the error:

Error 1 An error occurred while finding the resource dictionary "/Themes/Colors.xaml".

This works fine in VS2010. The build option is set to Page. All target frameworks are set to .NET 4.

The directory structure is this:

Host\Themes\Colors.xaml    
Plugins\EqPlugin\Source\ProblemFile.xaml

The themes are defined in the VEParameters project and have this declared:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:local="clr-namespace:EQPlugin;assembly=VEParameterTool">

The file where the error occurs is in the EqPlugIn directory and has this declared:

<UserControl x:Class="EQPlugin.EQControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:src="clr-namespace:VEParameterTool;assembly=VEParameterTool"             
             xmlns:l="clr-namespace:EQPlugin"  
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:oxy="http://oxyplot.codeplex.com"
             mc:Ignorable="d">

I have tried changing the paths to relative paths but that doesn't work, i have removed and re-added the assemblies, i have restarted etc, all projects are build for the same framework. I don't know what else to try.

Andy
  • 259
  • 1
  • 4
  • 16

1 Answers1

7

Try the below one, Provied the assembly name, even if it is in the same assembly

Source="pack://application:,,,/<assemblyName>;component/Themes/Colors.xaml" 
Kumareshan
  • 1,311
  • 8
  • 8
  • 1
    This worked for me... eventually. At first, adding the `pack://application:,,,` did not seem to make a difference. It was not until I applied a style from the merged dictionary to a control that the XAML designer finally stopped showing the error and displayed the form. – Wallace Kelly Jan 05 '16 at 21:29
  • for me , In VS2013, This is working. make sure no error in the Colors.xaml. – Joe.wang Feb 10 '17 at 05:59