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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:53:13+00:00 2026-05-29T03:53:13+00:00

We have a (massive) legacy WinForms app which, through a menu item, opens up

  • 0

We have a (massive) legacy WinForms app which, through a menu item, opens up a WPF form. This WPF form will host an Infragistics grid, and some buttons/drop-downs.

This lone WPF form represents the nascent stage of a migration to WPF. Later on, more components of the app will move to WPF, and ultimately the entire app itself.

As part of the migration, we would like to use Caliburn Micro. Hence, it would be nice if we could start by using it with this lone WPF form.

  • Can someone please provide some pointers on how to use Caliburn Micro with the WPF form?
  • Or perhaps tell me why it may not make sense to use Caliburn Micro just yet?

The documentation I’ve read so far involves boot strappers that ensure the application starts with the desired root view model, rather than the scenario above.

Many thanks!

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

    After much Googling and going through the Caliburn Micro source code, I’ve come up with an approach that works in a sample test application. I can’t post the test application here for certain reasons, but here’s the approach in a nutshell.

    • Create a WinForm with a button.
    • On button click, show a ChildWinForm
    • In the load handler of the ChildWinForm:

      
      // You'll need to reference WindowsFormsIntegration for the ElementHost class
      // ElementHost acts as the "intermediary" between WinForms and WPF once its Child
      // property is set to the WPF control. This is done in the Bootstrapper below.    
      var elementHost = new ElementHost{Dock = DockStyle.Fill};
      Controls.Add(elementHost);
      new WpfControlViewBootstrapper(elementHost);
      
    • The bootstrapper above is something you’ll have to write.

    • For more information about all it needs to do, see Customizing the Bootstrapper from the Caliburn Micro documentation.
    • For the purposes of this post, make it derive from the Caliburn Bootstrapper class.
    • It should do the following in its constructor:

      
      // Since this is a WinForms app with some WPF controls, there is no Application.
      // Supplying false in the base prevents Caliburn Micro from looking
      // for the Application and hooking up to Application.Startup
      protected WinFormsBootstrapper(ElementHost elementHost) : base(false)
      {
          // container is your preferred DI container
          var rootViewModel = container.Resolve();
          // ViewLocator is a Caliburn class for mapping views to view models
          var rootView = ViewLocator.LocateForModel(rootViewModel, null, null);
          // Set elementHost child as mentioned earlier
          elementHost.Child = rootView;
      }
      
    • Last thing to note is that you’ll have to set the cal:Bind.Model dependency property in the XAML of WpfControlView.

      
      cal:Bind.Model="WpfControls.ViewModels.WpfControl1ViewModel"
      
    • The value of the dependency property is used passed as a string to Bootstrapper.GetInstance(Type serviceType, string key), which must then use it to resolve the WpfControlViewModel.

    • Since the container I use (Autofac), doesn’t support string-only resolution, I chose to set the property to the fully qualified name of the view model. This name can then be converted to the type, and used to resolve from the container.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I working on the project now which will have massive multilevel menu - to
I have a WinForms app, and I have a massive Panel in it. And
I have this massive nested loop scenario that is calling the DB and making
I have this massive folder structure with thousands of folders and subfolders. I need
I have a massive number of shell commands being executed with root/admin priveleges through
I have a massive problem: I have a WPF application that makes a WcF
I have a massive string (we are talking 1696108 characters in length) which I
We have a massive spreadsheet which does a lot of calculations and not much
Lets say I have a massive project which consists of multiple dynamic libraries that
This has been killing me - I have a massive file that I need

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.