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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:22:17+00:00 2026-06-10T10:22:17+00:00

I am writing an application using WPF, MVVM, and PRISM regions. I have two

  • 0

I am writing an application using WPF, MVVM, and PRISM regions.

I have two regions with one view (A and B) per region. I add views to my regions in my regionmodules class as follows:

    // I use the following private properties in both regionmodules.cs class
    private readonly IUnityContainer _container;
    private readonly IRegionManager _regionManager;

–A–

    private void RegisterViews()
    {
        var controlsView = _container.Resolve<EmulatorControlsView>();
        _regionManager.Regions["ControlsRegion"].Add(controlsView, "A");
    }

–B–

    private void RegisterViews()
    {

        var templatesView = _container.Resolve<TemplatesView>();
        _regionManager.Regions["TemplatesRegion"].Add(templatesView, "B");

        var view = _regionManager.Regions["TemplatesRegion"].GetView("B");
        _regionManager.Regions["TemplatesRegion"].Deactivate(view);
    }

I deactivate view “B” during initialization of my app because view B overlays view A in my shell.xaml.

A click command from view A will activate view B and deactivate view A per the following code:

    private void LoadTemplateExecute()
    {
        var controlView = _regionManager.Regions["ControlsRegion"].GetView("A");
        _regionManager.Regions["ControlsRegion"].Deactivate(controlView);

        var templateView = _regionManager.Regions["TemplatesRegion"].GetView("B");
        _regionManager.Regions["TemplatesRegion"].Activate(templateView);
    }

Other button commands exist in my Templates region view model that Deactivates view A and Activates view B.

This code works great, and allows me to display my views on demand.

Problem: View B has a ListView bound to an ObservableCollection in the view model via dependency property. I currently add string items to my ObservableCollection by way of the view model constructor:

    private void InitializeTemporaryLists()
    {
        TemplateList.Add("Dog");
        TemplateList.Add("Cat");
        TemplateList.Add("Horse");
    }  

However, when view B is activated, my ObservableCollection does not show the items in its list.

Question: Is there an event available in the region view or view model to notify me when the view has become active?
What is the best way for me to populate data to my view from the view model each time my view becomes active?

Any ideas and code example are very much appreciated!

* Update *
My ListView was not updating because I am a silly programmer. I had not declared the ObservableCollection<> type in my dependency property.

However, I am still curious to know how you smart programmers out there might handle a prism region view activation? I wish I could subscribe to an event like the following:

_regionManager.Regions["YourRegion"].OnActiveView() += HandleActiveViewEvent;
  • 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-10T10:22:19+00:00Added an answer on June 10, 2026 at 10:22 am

    You can implement the IActiveAware interface to receive notifications when a view is activated and deactivated. This is called by the framework, if you implement it on on the view or the viewmodel (but not both).

    If you want activation notification from outside the view or viewmodel, you can also monitor the region’s ActiveViews collection for changes. This supports the INotifyCollectionChanged interface.

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

Sidebar

Related Questions

I'm writing an application using WPF MVVM. I have a view model with property
I am writing WPF application using MVVM. I have ObservableCollection of my items: public
I am writing an WPF MVVM application using Prism. A couple days ago I
I'm writing a WPF application using a MVVM pattern and using Prism in selected
I'm writing an application in WPF using the MVVM-pattern and will really often use
I'm writing a WPF application using the MVVM pattern, based on the following article:
I am writing a WPF application and in one user control I am using
I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna
When writing a WPF application using MVVM, I want to use a WCF service,
I'm writing an application in WPF using the MVVM pattern. In my application I've

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.