开发者

WPF ListView with textbox in column header, tab problem

I got a ListView in WPF with a GridView as view. I wanted to add textboxes to the column headings as filter mechanism. But when I set the cursor to the first column heading it does not tab to the next column开发者_开发问答 heading textbox. Instead it goes to the next control after the ListView.

Here is the sample:

<ListView>
    <ListView.View>
        <GridView>
            <GridView.Columns>
                <GridViewColumn>
                    <StackPanel>
                        <TextBlock>ABC</TextBlock>
                        <TextBox>YXZ</TextBox>
                    </StackPanel>
                </GridViewColumn>
                <GridViewColumn>
                    <StackPanel>
                        <TextBlock>Spalte Nummer 2</TextBlock>
                        <TextBox></TextBox>
                    </StackPanel>
                </GridViewColumn>
            </GridView.Columns>
        </GridView>                    
    </ListView.View>
</ListView>

How will I make the cursor to tab from the first column header textbox to the second column header textbox?


You should try setting TabIndex properties on your TextBox'es.

<TextBox TabIndex="0">YXZ</TextBox>

<TextBox TabIndex="1">Spalte Nummer 2</TextBox>


Edit: You should also set KeyboardNavigation.TabNavigation="Local" on your ListView.


Have you tried setting the TabIndex attribute on each TextBox?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜