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

  • Home
  • SEARCH
  • 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 3950764
In Process

The Archive Base Latest Questions

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

I’m seeing strange behavior when it comes to focus and keyboard navigation. In the

  • 0

I’m seeing strange behavior when it comes to focus and keyboard navigation. In the example below I have a simple ItemsControl that has been templated so that it presents a list of CheckBoxes bound to the ItemsSource.

<ItemsControl FocusManager.IsFocusScope="True"
              ItemsSource="{Binding ElementName=TheWindow, Path=ListOStrings}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <CheckBox Content="{Binding}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

For some strange reason the FocusManager.IsFocusScope=”True” assignment causes keyboard focus to fail to be set when checking a checkbox via a mouse click and for focus to jump out of the ItemsControl when a check box is checked using the space bar on the keyboard. Both symptoms seem to point to some strange navigation happening when the checkbox is checked but I’m having a hard time getting to the bottom of it.

This problem occurs if I set any parent element up the visual tree as a focus scope using this method. If I remove the FocusManager.IsFocusScope=”True” then the problems go away. Unfortunately I’m seeing this problem in a larger project where I cannot just remove these focus scopes without worrying about other focus related consequences.

Could somebody explain to me the strange behavior I’m seeing? Is this a bug or am I just completely missing something?

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

    This article explains it very well: http://www.codeproject.com/KB/WPF/EnhancedFocusScope.aspx

    For What was FocusScope Designed?

    Microsoft uses FocusScope in WPF to
    create a temporary secondary focus.
    Every ToolBar and Menu in WPF has its
    own focus scope.

    With this knowledge, we can clearly
    see why we have those problems:

    A toolbar button should not execute
    commands on itself, but on whatever
    had focus before the toolbar was
    clicked. To accomplish this, routed
    commands ignore the focus from focus
    scopes and use the ‘main’ logical
    focus instead. This explains why
    routed commands don’t work inside
    focus scopes.

    Why does the large text box in the
    test application screenshot still
    display a caret? I don’t know the
    answer to this – but why shouldn’t it?
    Granted, the text box doesn’t have the
    keyboard focus (the small text box in
    the WPF focus scope has that); but it
    still has the main logical focus in
    the active Window and is the receiver
    of all routed commands.

    And this part covers the behavior you’re seeing

    Why does the keyboard focus move to
    the large text box when you tab to the
    CheckBox in the WPF focus scope and
    press Space to toggle it?

    Well, this is exactly what you expect
    when you click a menu item or a
    toolbar: the keyboard focus should
    return to the main focus. All
    ButtonBase-derived controls will do
    this.

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

Sidebar

Related Questions

No related questions found

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.