开发者

Can't get keyboard focus/tab order to hyperlink when tabbing fwd

I have a bug to fix a hyperlink in a WPF app that can't be tabbed to. The control is skipped when you go forward, but if you tab backward (shift-tab) the link will get focus!

The window is set up with several panels: a top panel (usercontrol) where the link is, a main panel beneath with form content, and a toolbar on the right. Tabbing fwd will get all these controls fine but skip the top panel. If you shift-tab, you will get the hyperlink.

Help?

<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
        <RowDefinition x:Name="gridRowBanner" Height="71"/>
        <RowDefinition开发者_运维知识库 x:Name="gridRowFormContent"/>           
    </Grid.RowDefinitions>

    <UserControl FocusManager.IsFocusScope="True" KeyboardNavigation.TabNavigation="Continue"/>

    <TabControl Grid.Row="1" TabStripPlacement="Left" >

the usercontrol has this item that doesn't get focus, when you go forward, but does when you go backard:

        <TextBlock x:Name="textParentWorkItem" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" >
            <Hyperlink Cursor="Hand" Click="Hyperlink_Click" x:Name="linkParentWorkItem" KeyboardNavigation.IsTabStop="True" >
                <InlineUIContainer>                                
                    <TextBlock Text="{Binding ParentWorkItem[0].DisplayName, Mode=OneWay}" />
                </InlineUIContainer>
            </Hyperlink>
        </TextBlock>


Figured it out. I had this on the UserControl:

FocusManager.FocusedElement="{Binding ElementName=tabItemGeneral}"

Removed it and focus worked.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜