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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:26:38+00:00 2026-05-19T04:26:38+00:00

In my WPF application, I use Routed Commands quite often, since there are several

  • 0

In my WPF application, I use Routed Commands quite often, since there are several actions that can be fired from different places in the code.

Now the problem is this: this mechanism works perfectly as long as the main program window has the focus, but if I have a dialog window showing, commands stop working. So if I have a dialog box or window on top of the main window, commands basically stop beeing captured.

Testing a bit further, I found out that the commands themselves are executed, but they aren’t beeing routed correctly: in fact if I pass the object that contains the command binding as the “target” parameter in the Command.Execute() method they work… the problem is I don’t always have the target at hand (that’s why I use routed commands, because they are… well… routed!)

Maybe it’s something really stupid I’m not getting… I’m still learning with WPF.

Thanks!

  • 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-19T04:26:38+00:00Added an answer on May 19, 2026 at 4:26 am

    The problem is that the commands mechanism routes the command up the visual tree, that is it travels up the tree from the command target until it finds an element which contains a binding for the command. So when you try to execute the command from your dialog window the topmost element is the dialog window, it has no direct connection with the previous window in the visual tree.

    You either have to provide the target yourself or create the binding in the dialog window for it to be handled properly.

    If you open that dialog window from the previous window then specify the Owner property and you can use to as the command target.

    I hope that helps.

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

Sidebar

Related Questions

in my browser wpf application i use databinding to xml that comes from my
I have a WPF application where I have defined custom commands that use the
I'm currently trying to use a WPF component that makes use of Application.Current from
I have a C# WPF application that use several library assemblies. I was wondring
I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I
Goal: To use entity framework with N-tier in my WPF application. Problem: I can't
I have a ListView in a WPF Application that use Dynamic Binding . I
How can I use RichTextBox Target in WPF application? I don't want to have
I would like to use WebSockets in my Windows Forms or WPF-application. Is there
Im creating a WPF application and just wondering is there a way to use

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.