none
An error occurred while finding the resource dictionary (Tor Langlo) - 12/6/2007 6:00 PM PST

    Question

  • By: Tor Langlo


    Why does merging the Aero theme resource dictionary generate an error at 
    design time in Blend 2? It works just great at runtime.
    
    <Window
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	x:Class="UntitledProject9.Window1"
    	x:Name="Window"
    	Title="Window1"
    	Width="640" Height="480">
      <Window.Resources>
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/PresentationFramework.Aero, 
    Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, 
    ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
          </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
      </Window.Resources>
    	<Grid x:Name="LayoutRoot"/>
    </Window>
    
    Error message:
    
    'An error occurred while finding the resource dictionary 
    "/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, 
    PublicKeyToken=31bf3856ad364e35, 
    ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml".
    
    Inner exception: FileNotFoundException: Unable to find the specified 
    file.
    
    Including the resource dictionary directly seems to work:
    
      <Window.Resources>
        <ResourceDictionary Source="/PresentationFramework.Aero, Version=
    3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, 
    ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
      </Window.Resources>
    
    But it doesn't help me because I need to merge into one of my resource 
    dictionaries.
    
    Tor.
    
    Thursday, February 21, 2008 9:10 PM

All replies

  • By: Unni Ravindranathan (MS)


    We don't support merging in resource dictionaries that are defined inside 
    assemblies, without having a reference to the actual project and XAML. This 
    is something we would like to fix in the future, but I don't think we can 
    address this in v2.
    
    Thanks,
    -Unni
    
    "Tor Langlo" <tor@newsgroups.nospam> wrote in message 
    news:Xns99FEC110D640Ftorlanglostranda@207.46.248.16...
    > Why does merging the Aero theme resource dictionary generate an error at
    > design time in Blend 2? It works just great at runtime.
    >
    > <Window
    > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    > x:Class="UntitledProject9.Window1"
    > x:Name="Window"
    > Title="Window1"
    > Width="640" Height="480">
    >  <Window.Resources>
    >    <ResourceDictionary>
    >      <ResourceDictionary.MergedDictionaries>
    >        <ResourceDictionary Source="/PresentationFramework.Aero,
    > Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
    > ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
    >      </ResourceDictionary.MergedDictionaries>
    >    </ResourceDictionary>
    >  </Window.Resources>
    > <Grid x:Name="LayoutRoot"/>
    > </Window>
    >
    > Error message:
    >
    > 'An error occurred while finding the resource dictionary
    > "/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral,
    > PublicKeyToken=31bf3856ad364e35,
    > ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml".
    >
    > Inner exception: FileNotFoundException: Unable to find the specified
    > file.
    >
    > Including the resource dictionary directly seems to work:
    >
    >  <Window.Resources>
    >    <ResourceDictionary Source="/PresentationFramework.Aero, Version=
    > 3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
    > ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
    >  </Window.Resources>
    >
    > But it doesn't help me because I need to merge into one of my resource
    > dictionaries.
    >
    > Tor. 
    
    Friday, February 22, 2008 7:59 PM
  • By: Tor Langlo


    > We don't support merging in resource dictionaries that are defined
    > inside assemblies, without having a reference to the actual project
    > and XAML. This is something we would like to fix in the future, but I
    > don't think we can address this in v2.
    
    I guess that's okay, maybe a better error message would help (i.e. worded 
    like your message here). That would avoid developers/designers spending too 
    much time trying to figure out what's going on.
    
    I worked around the problem by creating a C# code behind  file for the 
    resource dictionary, and merged in the the Aero theme in my resource 
    dictionary's constructor (after calling InitializeComponent).
    
    Things are cool at designtime because I'm developing on Vista and get the 
    Aero theme by default. And with the workaround, users of my application get 
    the Aero theme as well. It was just too ugly on XP where my carefully 
    designed UI :-) suddenly got some really old styled controls showing up in 
    the middle (Windows 95 style buttons on machines that were configured with 
    Classic theme).
    
    Tor.
    
    Friday, February 22, 2008 7:59 PM