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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:35:34+00:00 2026-05-18T11:35:34+00:00

In my WPF 4.0 desktop-based application, I want to add an ability to traverse

  • 0

In my WPF 4.0 desktop-based application, I want to add an ability to traverse through window elements by pressing Tab-button.

Here is fragment of my XAML:

<!--main body layout-->
<StackPanel x:Name="BodyLayout"
        Style="{StaticResource Body_Block}">

    <!--teaser block-->
    <Grid x:Name="TeaserGrid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition />
        </Grid.RowDefinitions>

        <TextBlock Grid.Column="0"
               Grid.Row="0"
               Style="{StaticResource Body_Teaser_Centering}">
                <Hyperlink Style="{StaticResource Body_Teaser_Hyperlink}"
                       Focusable="True"
                       KeyboardNavigation.TabIndex="0"
                       Click="Call_WinOffences_Click">
                    <Image Source="Resources/teaser_offences.png"
                           Style="{StaticResource Body_Teaser_Image}" />
                    <LineBreak />
                    <TextBlock Text="Offences"
                            Style="{StaticResource Body_Title}" />
                </Hyperlink>
        </TextBlock>

        <TextBlock Grid.Column="1"
               Grid.Row="0"
               Style="{StaticResource Body_Teaser_Centering}">
            <Hyperlink Style="{StaticResource Body_Teaser_Hyperlink}"
                   Focusable="True"
                   KeyboardNavigation.TabIndex="1"
                   Click="Call_WinEvents_Click">
                <Image Source="Resources/teaser_events.png"
                       Style="{StaticResource Body_Teaser_Image}" />
                <LineBreak />
                <TextBlock Text="Events"
                       Style="{StaticResource Body_Title}" />
            </Hyperlink>
        </TextBlock>
    </Grid>
</StackPanel>

What exactly do I need?
I want to open this window and by pressing first time on Tab keyboard to set focus on Hyperlink block (with Image and TextBlock) with TabIndex="0" and by second Tab pressing to switch focus on element with TabIndex="1", also I want to cycle this switches. In other words, I want that user could navigate through elements in my window by Tab keyboard as we are regular to do this in any other normal WinForms application.

What actually have I right now?
When I press on Tab keyboard Hyperlinks don’t get focus and I can’t work with my window without the mouse.

Please, let me know, what am I doing wrong?

  • 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-18T11:35:35+00:00Added an answer on May 18, 2026 at 11:35 am

    Update
    I copied your sample code (except for the Styles which I didn’t have) into a small project and it seems to be working fine for me. I can launch the Window, press Tab to Focus first Hyperlink, press Enter and the Click event is raised, press Tab again etc. The only thing I can think is that something in your Styles overrides this behavior. I uploaded my sample project here.

    Note: I changed the Source for the Images so you’ll have to change them back 🙂

    Old post
    There are two parts here. The first one is if a FrameworkElement is Focusable or not. The second one is TabIndex. TabIndex is in Control which derives from FrameworkElement and not all elements derive from Control, such as TextBlock, Rectangle etc. If you for some reason want to add TabIndex to such elements as well you you can use KeyboardNavigation.TabIndex instead. Here’s an easy example with 6 controls with a Tab-Order set and 1 Rectangle isn’t Focusable (since it isn’t Focusable by default).

    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Button Grid.Row="0" Grid.Column="0"
                Content="Some Button"
                KeyboardNavigation.TabIndex="0"
                Margin="5"/>
        <TextBox Grid.Row="1" Grid.Column="0"
                 Text="Some TextBox"
                 KeyboardNavigation.TabIndex="2"
                 Margin="5"/>
        <TextBox Grid.Row="2" Grid.Column="0"
                 Text="Another TextBox"
                 KeyboardNavigation.TabIndex="1"
                 Margin="5"/>
        <TextBlock Grid.Row="0" Grid.Column="1"
                   Text="Focusable TextBlock"
                   Focusable="True"
                   KeyboardNavigation.TabIndex="4"
                   Margin="5"/>
        <Rectangle Grid.Row="1" Grid.Column="1"
                   Fill="Blue"
                   Margin="5"/>
        <Rectangle Grid.Row="2" Grid.Column="1"
                   Fill="Red"
                   Focusable="True"
                   KeyboardNavigation.TabIndex="3"
                   Margin="5"/>
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my desktop-based WPF-application I want to implement a toolbar with key actions (add,
I want to develope my first real WPF Desktop Application. It's quite a lot
I develop desktop-based WPF-application, that uses SQL Server 2008 R2 Database and ADO.NET Entity
In my WPF 4 desktop-based application, I have an LINQ query that makes a
Given: WPF 4.0 desktop-based application. Basic input form with two TextBox fields and submit
I have WPF 4 desktop-based application. In one of the windows of this application,
I have a DataGrid with data in my WPF 4 desktop-based application. When a
In my WPF 4.0 desktop-based application in order to localize my application (e.g. English
My desktop-based WPF-application (4.0) works with DB and in order to this it should
My WPF desktop-based application uses ADO.Net Entity Framework in order to connect to SQL

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.