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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:03:30+00:00 2026-05-21T02:03:30+00:00

How do I unload a view from a Prism Region? I am writing a

  • 0

How do I unload a view from a Prism Region?

I am writing a WPF Prism app with a Ribbon control in the Shell. The Ribbon’s Home tab contains a region, RibbonHomeTabRegion, into which one of my modules (call it ModuleA) loads a RibbonGroup. That works fine.

When the user navigates away from ModuleA, the RibbonGroup needs to be unloaded from the RibbonHomeTabRegion. I am not replacing the RibbonGroup with another view–the region should be empty.

EDIT: I have rewritten this part of the question:

When I try to remove the view, I get an error message that “The region does not contain the specified view.” So, I wrote the following code to delete whatever view is in the region:

// Get the regions views
var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
var ribbonHomeTabRegion = regionManager.Regions["RibbonHomeTabRegion"];
var views = ribbonHomeTabRegion.Views;

// Unload the views
foreach (var view in views)
{
    ribbonHomeTabRegion.Remove(view);
}

I am still getting the same error, which tells me there is something pretty basic that I am doing incorrectly.

Can anyone point me in the right direction? Thanks for your help.

  • 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-21T02:03:30+00:00Added an answer on May 21, 2026 at 2:03 am

    I found my answer, although I can’t say I fully understand it. I had used IRegionManager.RequestNavigate() to inject the RibbonGroup into the Ribbon’s Home tab, like this:

    // Load RibbonGroup into Navigator pane
    var noteListNavigator = new Uri("NoteListRibbonGroup", UriKind.Relative);
    regionManager.RequestNavigate("RibbonHomeTabRegion", noteListNavigator);
    

    I changed the code to inject the view by Registering it with the region, like this:

    // Load Ribbon Group into Home tab
    regionManager.RegisterViewWithRegion("RibbonHomeTabRegion", typeof(NoteListRibbonGroup));
    

    Now I can remove the RibbonGroup using this code:

    if(ribbonHomeTabRegion.Views.Contains(this))
    {
        ribbonHomeTabRegion.Remove(this);
    }
    

    So, how you inject the view apparently matters. If you want to be able to remove the view, inject by registration with the Region Manager

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

Sidebar

Related Questions

I am writing an app using the MVVM (Model-View-ViewModel) pattern and am leveraging the
I'm trying to unload a view controller from view when the iPhone goes to
I found that UIImagePickerController can unload your parent view, especially if you bring up
I'm sooo close... but I don't quite see the connection from the upload view
posting from an app (iOS android etc..) not a web form. class someImage(models.Model): image
I am creating a Prism 4 demo app to learn the new framework, focusing
I am writing an image upload form using ASP.NET MVC 3. In the view,
When I run my app in landscape mode, the second time my view controller's
I've got a View that contains code that allows the user to upload images.
I have an app based on Apple's PageControl sample. The first time the view

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.