Error when adding code behind for Silverlight resource dictionary: AG_E_PARSER_BAD_TYPE

Posted by rwwilden on Stack Overflow See other posts from Stack Overflow or by rwwilden
Published on 2009-11-13T08:58:30Z Indexed on 2010/04/07 13:53 UTC
Read the original article Hit count: 860

Filed under:
|
|

Hi,

It should be possible to add a code behind file for a resource dictionary in Silverlight, but I keep getting the same error, thrown from the InitializeComponent method of my App.xaml constructor: XamlParseException: AG_E_PARSER_BAD_TYPE.

The resource dictionary xaml file looks like this:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="Celerior.Annapurna.SL.ProvisiorResourceDictionary"
    x:ClassModifier="public">
    ...
</ResourceDictionary>

If I remove the x:Class attribute everything works fine again (of course, I double-checked the class name and it's correct). My App.xaml file isn't really exciting and just contains a reference to the resource dictionary:

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="Celerior.Annapurna.SL.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ProvisiorResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

What am I doing wrong?

Kind regards,

Ronald Wildenberg

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about silverlight-3.0