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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:52:17+00:00 2026-05-24T15:52:17+00:00

So i basically have this ListView and i would like to press Tab and

  • 0

So i basically have this ListView and i would like to press Tab and iterate through my TreeViewItems (preferrably only my TextBoxes)

<ListView>
    <ListView.View>
        <GridView>
            <GridViewColumn  Header="number"  />
            <GridViewColumn Header="Selector">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBox Text="{Binding SelectorName}"/>
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>

The scenario that i am seeing is after pressing the tab for the first time the whole first TreeViewItem is selected and pressing Tab again the first TextBox is selected .Finally the third TAB gets out of the TreeView to the next Control although there are more TextBoxes that i would like to catch before “tabing” to to the next Control.
Thankx

Edit :
The Question was answered here :
How to TAB through TextBoxes in a ListView

  • 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-24T15:52:18+00:00Added an answer on May 24, 2026 at 3:52 pm

    Maybe i am missing something but i cannot find any simple method to do this, here would be an outline of what you could do:

    <ListView.InputBindings>
        <KeyBinding Key="Tab" Command="{Binding GoToNextItem}"
                CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=ListView}}" />
        <KeyBinding Modifiers="Shift" Key="Tab" Command="{Binding GoToPreviousItem}"
                CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=ListView}}" />
    </ListView.InputBindings>
    <ListView.ItemContainerStyle>
        <Style TargetType="{x:Type ListViewItem}">
            <EventSetter Event="Selected" Handler="ItemSelected" />
        </Style>
    </ListView.ItemContainerStyle>
    <ListView.View>
        <GridView>
            <GridViewColumn  Header="number"  />
            <GridViewColumn Header="Selector">
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBox Name="_tb" Text="{Binding SelectorName}"/>
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
        </GridView>
    </ListView.View>
    

    Things i did here:

    • Override tab behavior to fire commands to select another item
    • Add event handler to selected event to focus the TextBox
    • Name TextBox so it can be found and focused

    Code:

    private readonly ICommand _GoToNextItem = new Command((p) =>
        {
            var lv = p as ListView;
            if (lv.SelectedIndex == -1 || lv.SelectedIndex == lv.Items.Count - 1)
            {
                lv.SelectedIndex = 0;
            }
            else
            {
                lv.SelectedIndex++;
            }
        });
    public ICommand GoToNextItem { get { return _GoToNextItem; } }
    
    private readonly ICommand _GoToPreviousItem = new Command((p) =>
    {
        var lv = p as ListView;
        if (lv.SelectedIndex <= 0)
        {
            lv.SelectedIndex = lv.Items.Count - 1;
        }
        else
        {
            lv.SelectedIndex--;
        }
    });
    public ICommand GoToPreviousItem { get { return _GoToPreviousItem; } }
    
    private void ItemSelected(object sender, RoutedEventArgs e)
    {
        var item = sender as ListBoxItem;
        (FindNamedChild(item, "_tb") as TextBox).Focus();
    }
    
    public static object FindNamedChild(DependencyObject container, string name)
    {
        if (container is FrameworkElement)
        {
            if ((container as FrameworkElement).Name == name) return container;
        }
        var ccount = VisualTreeHelper.GetChildrenCount(container);
        for (int i = 0; i < ccount; i++)
        {
            var child = VisualTreeHelper.GetChild(container, i);
            var target = FindNamedChild(child, name);
            if (target != null)
            {
                return target;
            }
        }
        return null;
    }
    

    This is very sketchy, use any part of this at your own risk. (The focusing also could have been done differently without bringing the selection into this i think)

    (The Command class is just a generic implementation of ICommand which takes a lambda which is executed in the interface’s Execute method)

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

Sidebar

Related Questions

I basically have something like this: void Foo(Type ty) { var result = serializer.Deserialize<ty>(inputContent);
Basically, I have a custom ListView in which each item looks like: <LinearLayout> <Table>
I have this error that is keeping me from moving forward. I basically have
Well basically I have this script that takes a long time to execute and
I have this script which basically toggles a bgColor class on and off so
I have this grand idea to basically employ some brute force attack to test/verify
I have this form. Basically what I want is to send a auto-response with
I basically have three tables, posts, images and postimages (this simply contains the ids
Basically, I have this webpage that is the header on any page you go
So, I have this desktop app built using WPF and C#. It's basically an

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.