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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:56:01+00:00 2026-05-26T02:56:01+00:00

I am developing a Prism application where I need to publish view-models in a

  • 0

I am developing a Prism application where I need to publish view-models in a new window. To achieve that I created a service dedicated to the publication of these view-models. I call it like this:

windowService.Publish(myViewModel);

And the body of the Publish method is like this:

public void Publish(FloatingViewModel viewModel)
{
    var floatingWindow = ServiceLocator.Current.GetInstance<FloatingWindow>();

    floatingWindow.DataContext = viewModel;
    floatingWindow.Show();
}

After the Show() method execution, the new window quickly shows up above my main window and then disappears behind my main window like if it took back the focus.

Does anybody knows where this behavior could come from?

  • 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-26T02:56:01+00:00Added an answer on May 26, 2026 at 2:56 am

    I finally found the problem and it was actually way deeper than I thought. This answer will not be relevant of the described problem as the root cause was totally different.

    The code that was publishing the view-model in a window was actually nested in a WPF command and this command was attached to the MouseDoubleClick event through a InvokeCommandAction. I discovered that even when you bind an event to a command, the event is not marked as handled and therefore will propagate until it is handled. That was causing my main window to take back the focus.

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

Sidebar

Related Questions

I'm developing a WPF Prism application, and everything is working fine. My view models
I am developing Silverlight application with Prism 4 and WCF RIA service. I had
I'm developing a WPF/PRISM based application. The parent view(usercontrol) has many regions in it
I'm developing a SL3 application with Prism. I need to have support for validation
Developing an HTML 5 application on new iPad's Mobile Safari iOS 5 that displays
I'm currently developing a silverlight application with prism. From this application I need to
I'm developing an application using Mozilla Prism. Unfortunately, Prism has its pop-up blocker activated.
Developing a .NET WinForms application: how can I check if the window is in
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
I have an application which I am developing using WPF\Prism\MVVM. All is going well

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.