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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:12:55+00:00 2026-06-06T12:12:55+00:00

In my Shell window I have a workspace region to allow view switching via

  • 0

In my Shell window I have a workspace region to allow view switching via RequestNavigate. I’m using Unity with a View-First approach such that the view initialization look like:

public partial class WelcomeView : UserControl
{
    public WelcomeView(WelcomeViewModel vm)
    {
        InitializeComponent();
        this.DataContext = vm;
    }
}

When the application loads, I want to navigate to a default view so my BootStrappers InitializeShell looks as follows:

protected override void InitializeShell()
{
    Application.Current.MainWindow = (Window)Shell;
    Application.Current.MainWindow.Show();

    var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
    regionManager.RequestNavigate("MainWorkspaceRegion", "WelcomeView");
}

Now, my default view, WelcomeView, requires a WelcomeViewModel to be injected in the constructor, and in turn, the WelcomeViewModel requires some service to be injected in its constructor:

public class WelcomeViewModel : INotifyPropertyChanged
{
    public WelcomeViewModel(ISomeService someService)
    {
         // Use some service
         someService.SomeEventOccured += new Action(someService_SomeEventOccured);
    }

    ...
}

The problem is when ISomeService is supplied by a module, since the module is not initialized at the time InitializeShell is called, WelcomeViewModel cannot be constructed and in turn neither can WelcomeView.

Whats the proper way to do this?

  • 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-06T12:12:57+00:00Added an answer on June 6, 2026 at 12:12 pm

    The proper way to do this is to use a module dependency

    So the module that has dependencies will contain

    [ModuleDependency("SomeModule")] 
    [ModuleDependency("SomeOtherModule")] 
    public class MyModule : IModule { } 
    

    And the module on which it is dependent will contain:

    [Module(ModuleName = "SomeModule")] 
    public class MyOtherModule: IModule 
    

    it also makes sense not to use “magic strings”, as I have here and, instead have a static class in your common/infrastructure project that contains the names of all your modules.

    This will allow prism to load the modules in the correct order so that your dependencies always resolve.

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

Sidebar

Related Questions

I am using cygwin to get unix environment on windows. I have some shell
I have been playing with the Command Window in Visual Studio (View->Other Windows->Command Window).
I have a Window shell that is basically: <Window> <ContentPresenter Content={Binding} /> </Window> Injected
I have an RCP application in which i changed position of the window(shell) and
I have a lot of session state when programming - shell windows, ides, virtual
I am talking about windows shell extensions. I have a shell extension which could
Utility: NMake Platform : Windows 7 I have the following Makefile FILE = $(shell)
I have to use windows to write some shell scripts. I decided to use
Is there a standard set of return code for Window shell scripts (*.bat files)?
I use emacs23.4 on window xp. So the shell-mode use windows cmd.exe. I encountered

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.