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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:34:29+00:00 2026-05-22T23:34:29+00:00

I have spent two day trying to figure it out. I have implemented two

  • 0

I have spent two day trying to figure it out.

I have implemented two ways of working with mvvm popup windows

Example of the first aproach usage:

_childWindowController
                .ShowDialogWithResult<AddNationalityPopup,AddNationalityPopupModel, AddNationalityResult>(
                    (result, a) =>
                    {
                        if (a.DialogResult.HasValue && a.DialogResult.Value)
                        {
                            if (result.NationalityCountryId.HasValue)
                            {
                                Background.NationalityCountryId = result.NationalityCountryId.Value;
                                Background.NationalityDescription = result.NationalityDescription;
                            }
                        }
                    });

The second approach:

var window = _childWindowController.CreateDialog<AddNationalityPopup>();

    window.Closed += (sender, args) =>
    {
        if (args.DialogResult.HasValue && args.DialogResult.Value)
        {
            var result = (AddNationalityResult)window.Result;
            if (result.NationalityCountryId.HasValue)
            {
                Background.NationalityCountryId = result.NationalityCountryId.Value;
                Background.NationalityDescription = result.NationalityDescription;
            }
        }
    };

    window.ShowDialog();

In the first approach user of the service should know the types of view , view model, and result to be able to show dialog

In the second one interface is simplified a bit, but I still had to know to what type cast the result before its usage.

Have you ever faced the problem of showing dialog with view model?

How to improve the design of the window service?

Can you give an example of good implementation of the dialog service?

  • 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-22T23:34:30+00:00Added an answer on May 22, 2026 at 11:34 pm

    I recommend you take a look at User Interaction Patterns, as it goes over the different approaches you can take to handling user interactions in MVVM. An alternative to using an interaction service is to implement an interaction request object.

    Another approach to implementing
    simple user interactions in the MVVM
    pattern is to allow the view model to
    make interaction requests directly to
    the view itself via an interaction
    request object coupled with a behavior
    in the view. The interaction request
    object encapsulates the details of the
    interaction request, and its response,
    and communicates with the view via
    events. The view subscribes to these
    events to initiate the user experience
    portion of the interaction. The view
    will typically encapsulate the user
    experience of the interaction in a
    behavior that is data-bound to the
    interaction request object provided by
    the view model.

    This approach provides a simple, yet
    flexible, mechanism that preserves a
    clean separation between the view
    model and the view — it allows the view
    model to encapsulate the application’s
    presentation logic, including any
    required user interactions, while
    allowing the view to fully encapsulate
    the visual aspects of the interaction.
    The view model’s implementation,
    including its expected interactions
    with the user through view, can be
    easily tested, and the UI designer has
    a lot of flexibility in choosing how
    to implement the interaction within
    the view via the use of different
    behaviors that encapsulate the
    different user experiences for the
    interaction.

    For an example of how implement this, I recommend you take a look at the Prism 4 library source code and its samples. The Prism library supports this pattern through the IInteractionRequest interface and the InteractionRequest class. The IInteractionRequest interface defines an event to initiate the interaction, while behaviors in the view bind to this interface and subscribe to the event that it exposes.

    You could utilize the classes and interfaces defined in the Microsoft.Practices.Prism.Interactivity assembly, or use these types as a basis for implementing your dialog service.

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

Sidebar

Related Questions

I have spent about an hour or two trying to find out how to
I've spent two days on this and have gotten nowhere. I'm trying to use
Can two Derby databases run on the same host? I have spent a day
I have spent all day trying to solve this with no satisfying results. I
I've spent a day trying to a simple compiler program but still have difficulties
I spent around two hours on that problem, and I have visited these stackoverflow
Have spent an hour trying to solve this - but to no avail. I'm
I have spent last 3 days until I got gps working on android using
I have spent hours in this problem and my fellows couldn't help me out.
I have spent the afternoon trying to wrap my mind around how to translate

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.