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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:48:11+00:00 2026-05-20T01:48:11+00:00

I guess the question in the title is clear enough.What happens when i call

  • 0

I guess the question in the title is clear enough.What happens when i call

ApplicationCommands.Close.Execute(null,null)

from my viewmodel class.

I have a modeldialog which shows a usercontrol.I have a commandbinding to a button in the usercontrol which is executed in the viewmodel.I want to close the dialog after the command is executed.It can be done by using the above command to the end of the executed event.

But i am wondering if this is the right approach.Will this cause any undesired effect ?

  • 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-20T01:48:12+00:00Added an answer on May 20, 2026 at 1:48 am

    Unfortunately this won’t work.

    ApplicationCommands.Close is a RoutedUiEvent which requires a Commandtarget (any IInputelement). It uses this command target to raise a routedevent.

    You can then handle this routedevent via using a commandbinding.

    From the ViewModel you could bind ApplicationCommands.Close to Close Button and then handle the routed close event in your window.

    However you can’t call ApplicationCommands.Close.Execute(null,null) in your ViewModel after another command is executed as you have no CommandTarget (the second null)

    There are other threads like this one How should the ViewModel close the form? which detail various methods to acheive this.

    http://adammills.wordpress.com/2011/02/16/mvvm-uses-for-applicationcommands-close/

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

Sidebar

Related Questions

I guess the title of the question is clear enough. What I want to
The question is clear on the title I guess? How to get GMap2 object
I guess the question title sums it up. Is there a time when it
This is more of a general design question I guess... I have an Ajax
I guess the question is in the title: I want to apply a style
The title might not be clear enough because I don't know how to define
Sorry for the long question title. I guess I'm on to a loser on
This question title is taken from the title of item #23 in Effective C++
I decided that my previous question wasnt perhaps clear in both title and result,
Everything's in the question title I guess... I tried the findmyip kind of site,

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.