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

  • SEARCH
  • Home
  • 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 8444625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:26:28+00:00 2026-06-10T09:26:28+00:00

I have been trying to load a resource dictionary XAML file in my view

  • 0

I have been trying to load a resource dictionary XAML file in my view model. I am able to instantiate it, and calls to it do not result in an immediate error, but after control returns to the UI, there is an error popup “Error HRESULT E_FAIL has been returned from a call to COM component”.

I am doing the following:

  • ResourceDictionary file is ViewModelsResources.xaml located in MyApp/ViewModels where MyApp is the root folder of my Silverlight application
  • ViewModelsResources.xaml is marked Build Action: Content, Copy to Output Directory: Copy always, Custom Tool: MSBuild:Compile
  • The ResourceDictionary object is instantiated with (and this code is in a class in the same folder as the resource dictionary file)
    ResourceDictionary VMResources = new ResourceDictionary()
    {
        Source = new Uri("/ViewModels/ViewModelsResources.xaml", UriKind.Relative)
    };
  • The object is then referenced through index based on x:Key values: Template1 = VMResources["myTemplate"] as ControlTemplate; (same class as code sample above)

Debugging shows that VMResources and Template1 are being assigned good values. I don’t know why this would be throwing errors about COM components, but I have isolated it to when this ResourceDictionary is referenced. If I take out the lines referencing VMResources[x] there is no error. Any help would be much appreciated.

  • 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-06-10T09:26:29+00:00Added an answer on June 10, 2026 at 9:26 am

    Turns out this does work as I described, but you can’t have events specified in the templates found in the resource dictionary. I should have realized that was going to cause problems, COM was throwing me off though. To get around the need for event handlers, I am using Behaviors. There’s tons of reading out there on Behaviors. I started here and here.

    note: If anyone believes I should delete this question since it actually works as proposed, just comment as so. I figure leaving this might help someone trying to do the same thing as me though.

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

Sidebar

Related Questions

I have been trying to load a html file in a webview in a
I have been trying to load a text file into a combobox, and then
i am new kernel programming.i have been trying to load this driver program for
Have been trying to encrypt an xml file to a string so that I
I have been trying with no luck to load a google map over a
I have been trying: to load an image into a window control with a
I have been trying to load a 32-bit dll using C++ (from a 32-bit
I have been trying to read an xml file. I have to extract value
I have been trying to load my pre-filled database into my device, ive tried
I have been trying to load function from the js script of detecting mobile

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.