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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:07:53+00:00 2026-05-23T13:07:53+00:00

This is probably one of those questions where the answer really should be too

  • 0

This is probably one of those questions where the answer really should be too obvious for any to miss. Still, I can’t seem to figure out why my “play&learn” application behaves the way it does.

On my Mainpage.xaml I have a StackPanel containing several HyperlinkButtons which navigates to a set of NavigationPages. There is also a NavigationFrame with a UriMapper to hold the “pages”.

<StackPanel Background="Black" Orientation="Horizontal" Grid.Row="0">
    <HyperlinkButton Name="Home" 
                     TargetName="MainPageFrame" NavigateUri="/Home"
                     Foreground="White" FontWeight="Bold" Content="Home" />
    <HyperlinkButton Name="Users" 
                     TargetName="MainPageFrame" NavigateUri="/Users"
                     Foreground="White" FontWeight="Bold" Content="Users" />
    <HyperlinkButton Name="Store" Foreground="White" FontWeight="Bold" Content="Store"
                     TargetName="MainPageFrame" NavigateUri="/Stores"/>          
</StackPanel>
<navigation:Frame x:Name="MainPageFrame" Grid.Row="1" Source="/Home" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" JournalOwnership="Automatic">
    <navigation:Frame.UriMapper>
        <uriMapper:UriMapper>
            <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
        </uriMapper:UriMapper>
    </navigation:Frame.UriMapper>
</navigation:Frame>

Here’s the problem. When I go back and forth between the pages (i.e: click on Stores, Users and back on Stores) then two Stores pages are created. Though not visible in the application at first glance the problem materialize itself when I a child window is opened from the Stores Page.

As I use MVVM light messaging to notify that the child window should open, … I get two child windows (or one for each time I have entered the stores navigation page from the hyperlinkbuttons).

I presumed that while clicking on the Hyperlink buttons, you would only have one NavigationPage ..or at least the current was destructed while leaving the navpage.

What clearly obvious thing am I missing?

  • 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-23T13:07:54+00:00Added an answer on May 23, 2026 at 1:07 pm

    The problem lies most likely in the registration of the message handler. There is a known problem with the MVVM Light Messenger, that results in the object handling a message not being released propperly.

    The solution is quite simple – assuming that your view handles the message – your code behind should look something like this:

    public StoreView() {
        Messenger.Default.Register<NotificationMessage>(this, (m) => {
            // some message handling
        });
    
        InitializeComponent();
    }
    

    Now modify it so it looks similar to this:

    public StoreView() {
        Messenger.Default.Register<NotificationMessage>(this, (m) => {
            // some message handling
        });
    
        InitializeComponent();
    
        this.Unloaded += (sender, args) => {
            Messenger.Default.Unregister(this);
        };
    }
    

    The code in the unloaded event ensures that the message handler is properly unregistered. For messages in ViewModels ensure that the Cleanup method is called.

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

Sidebar

Related Questions

This is probably one of those questions with an obvious answer, but when I
Hey, so this is one of those questions that seems obvious, and I'm probably
This is one of those I probably should know this, but I don't questions.
This is probably a simple one but I can't seem to figure it out.
This is probably one of those easy questions.. I'm trying to redirect the user
This is probably a simple one to answer, but I'm stuck, so here goes.
Morning y'all This is probably an easy one but I barely got any sleep
This is probably a really simple question but one I've never quite worked out
This is probably a really easy question to answer, but for some reason I'm
So, since the answer to this basically said that I really should look into

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.