views:

7

answers:

1

Guys,

I can't make KeyboardNavigation work for tree view. I figured out that the problem my some how related to the TreeViewItem, check this out for example:

For ListBoxItem KeyboardNavigation works:

<ListBoxItem>
    <StackPanel>
        <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="1"/>
        <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="2"/>
        <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="3"/>
    </StackPanel>
</ListBoxItem>

While on TreeViewItems it refuses to work:

<TreeViewItem>
    <StackPanel>
        <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="1"/>
        <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="2"/>
        <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="3"/>
    </StackPanel>
</TreeViewItem>

I ran a separate test containing only(!) the above code on a new project in an empty window.

Can anyone pls help :-)

Gili

A: 

Ok found the problem:

<TreeViewItem Style="{StaticResource TreeViewItemStyle}" KeyboardNavigation.TabNavigation="Continue"> 
    <TreeViewItem.Header>
        <StackPanel>
            <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="1"/>
            <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="2"/>
            <TextBox Height="20" Width="300" KeyboardNavigation.TabIndex="3"/>
        </StackPanel>
    </TreeViewItem.Header>
</TreeViewItem>
Gilad
Ignore the style - it is not related
Gilad