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 8704053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:00:03+00:00 2026-06-13T03:00:03+00:00

I have a WPF container application (with ContentControl host) and a containee application (

  • 0

I have a WPF container application (with ContentControl host) and a containee application (UserControl). Both are oblivious of each other.

Only one XML config file holds the string dllpath of the containee’s DLL and full namespace name of the ViewModelClass inside the containee.

A generic code in container resolves containee’s assembly (Assembly.LoadFrom(dllpath)) and creates the viewmodel’s instance using Activator.CreateInstance(vmType). when this viewmodel is hosted inside the ContentControl of the container, and relevant vierwmodel specific ResourceDictionary is added to ContentControl.Resources.MergedDictionaries of the content control of container, so the view loads fine.

Now my containee has to host the WPF DataGrid using assembly reference of WPFToolkit.dll from my local C:\Lib folder.

The Copy Local reference to the WPFToolkit.dll is added to the .csproj file of the containee’s project and its only referred in the UserControl.XAML using its XAML namepsace. This way my bin\debug folder in my containee application, gets the WPFToolkit.dll copied.

XAML:

xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
<Controls:DataGrid ItemsSource="{Binding AssetList}" ... />

Issue:
The moment the ViewModel (i.e. the containee’s usercontrol) tries to load itself I get this error.

“Cannot find type ‘Microsoft.Windows.Controls.DataGrid’. The assembly used when compiling might be different than that used when loading and the type is missing.”

Hence I tried to load the referenced assemblies of the containee’s assembly (myAssembly.GetReferencedAssemblies()) before the viewmodel is hosted. But WPFToolkit isnt there in that list of assemblies!

Strange thing is I have another dll referred called Logger.dll in the containee codebase but this one is implemented using C# code behind. So I get its reference correctly resolved in myAssembly.GetReferencedAssemblies().

So does that mean BAML references of assemblies are never resolvable by GetReferencedAssemblies?

EDIT:

Forgot to add I did a post build event in containee to xcopy all bin\debug\*.* to container’s ‘bin\debug’. It works then. But I dont want all containee’s being copied like that to the container. Container should be oblivious of containee applications (even dlls) until runtime.

  • 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-13T03:00:04+00:00Added an answer on June 13, 2026 at 3:00 am

    Solution to your problem might be to add handler to AppDomain.AssemblyResolve event. This event is called as last resort when an assembly is needed and your application cannot find is in an ordinary way. This is the place where you can customize this process by scanning your containees folders (read from config so no hard relationship) in an attempt to find needed dll.

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

Sidebar

Related Questions

I have WPF Application where I have One main form and other user controls
In my WPF application, I have a Canvas object that contains some UserControl objects.
I have a WPF application that contains some Window s with few UserControl s
I have a WPF UserControl with Focusable=True. It's the only focusable control in the
I'm developing WPF Prism application using Unity container. The issue is: I have a
I have a usercontrol in my wpf application which is causing a stackoverflowexception to
Guys, I have a basic WPF application. Contains App.xaml as always and a Mainwindow.xaml.
I want my WPF application to have a ToggleButton that contains an image of
I have a WPF form which contains 30x30 grid where each grid cell is
I have a WPF application which has a main window composed from several custom

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.