Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 458339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:39:42+00:00 2026-05-12T22:39:42+00:00

It should be possible to add a code behind file for a resource dictionary

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:39:42+00:00Added an answer on May 12, 2026 at 10:39 pm

    Silverlight does not support the x:ClassModifier thats only supported in WPF.

    In addition x:Class isn’t valid in a Resource dictionary. Certainly when trying to include the Xaml from the resource dictionary as a merged dictionary Silverlight wouldn’t know what to do with the x:Class at that point.

    Actually the above isn’t strictly true x:Class is valid but the way you are including the dictionary in the application dictionary needs tweaking. Let me first just state that there is the assumption here that you actually need to sub-class ResourceDictionary (if not just drop the x:Class).

    I’m also going to go out on a limb based on your inclusion of x:ClassModifier that you actually don’t have a ProvisiorResourceDictionary.xaml.cs file in your project. Since SL always creates a public partial you need this file to contain at least:-

    public partial class ProvisiorResourceDictionary
    {
        public ProvisiorResourceDictionary()
        {
            InitializeComponent();
        }
    }
    

    That said if don’t have something like this already then you may as well just drop x:Class altogether.

    Now your app.xaml needs to look like this:-

    <Application.Resources>
      <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
          <common:ProvisiorResourceDictionary /> 
        </ResourceDictionary.MergedDictionaries>
      </ResourceDictionary>
    </Application.Resources>
    

    Instead of trying to import the XAML file as resource via the Source property you now include an instance of the specialised ResourceDictionary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 214k
  • Answers 214k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Easiest approach Download Apache Commons IO from the Apache foundations… May 12, 2026 at 10:41 pm
  • Editorial Team
    Editorial Team added an answer setInterval(requestQueue.callQueue, 100); Peels off the callQueue method from requestQueue and… May 12, 2026 at 10:41 pm
  • Editorial Team
    Editorial Team added an answer This post by marihanzo on the PDFSharp forums has worked… May 12, 2026 at 10:41 pm

Related Questions

yesterday I just asked following question. How to customize tableView Section View - iPhone
I am writing a bit of code to add a link tag to the
I'm trying to create a SplitButton control that uses a ContextMenu to display its
I just started playing with memcache(d) last night so I have a LOT to
My application is developped in C++ using Qt and is using signals and slots.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.