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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:09:28+00:00 2026-06-16T03:09:28+00:00

I have a window with a toolbar which contains some buttons with commands. The

  • 0

I have a window with a toolbar which contains some buttons with commands.
The Buttons stopped working since i replaced the toolbar with a stackpanel containing the buttons.

In my understanding this shound not make any difference. The buttons still have the Command property set, i did not change anything in my custom commands class and the CommandBinding are also still the same. They are implemented some grids and usercontrols deeper than the button, but they do work, as long as the buttons are in a ToolBar control!

If i implement CommandBindings directly in the Window they work (but that is not what i want)

Here’s the code (abridged):

<Window>
    <Grid>
        <StackPanel>
            <Button Command="gui:GuiCommands.Hello">Hello</Button>
        </StackPanel>

        <Grid>
            <TabControl>
                <TabItem Header="MyTab">
                    <Grid>
                        <Grid.CommandBindings>
                            <CommandBinding Command="gui:GuiCommands.Hello" Executed="hello_Clicked"/> <!-- THIS WOULD NOT WORK -->
                        </Grid.CommandBindings>
                    <Grid>
                </TabItem>
            </TabControl>
        </Grid>
    </Grid>

    <Window.CommandBindings>
        <CommandBinding Command="gui:GuiCommands.Hello" Executed="hello_Clicked"/> <!-- THIS WOULD WORK -->
    </Window.CommandBindings>
</Window>

I know it would not compile but i had to simplify it. This works as soon as i replace “StackPanel” with “ToolBar” with my app. How can that be?

  • 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-06-16T03:09:30+00:00Added an answer on June 16, 2026 at 3:09 am

    Okay, i guess is figured it out by my self again (why does this always happen right after i posted the question?)

    Short: I needed to set FocusManager.IsFocusScope="true" on the StackPanel

    Long: see the answer to this question: Do I have to use CommandTarget? I thought any focused element would receive the Command

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

Sidebar

Related Questions

I have a WPF usercontrol, which contains a toolbar with 5 buttons. The commands
I have a StackPanel containing a StackPanel and some other items. The first StackPanel
I have a window containing three NSTextField s, like this: +------------------------+ | +--------------------+ |
I have main window which has inner grid components. When I press a button
I have a dynamically created toolbar on a plain Win32 dialog. My buttons are
I have a WPF application which has a main window composed from several custom
I have a shell which looks like toolbar and defines my main region (a
I have a java application which requires to add button sets contains in jpanels
I have some trouble with creating window application using PyQt. For example: we have
I have Swing application which manipulate shapes. In my toolbar I have a zoom

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.