wpf禁用按钮上的文本选项卡导航

时间:2013-12-22 17:14:10

标签: wpf tabs navigation

我有以下两个按钮:

  1. Button1的 BUTTON2

  2. 将Button2

  3. 如果是button1,则内部的stackpannel会聚焦。 对于button2,当使用选项卡导航时,ContentText会聚焦。

    我正在尝试禁用按钮内容的标签导航,但没有成功。 我已尝试过以下各项:     KeyboardNavigation.IsTabStop = “假”     FocusManager.IsFocusScope = “假”     KeyboardNavigation.TabNavigation = “无”

    但他们都没有帮助我。

    更新: 我已将代码包含在第一篇文章中,但它没有出现。对不起,我很擅长堆叠。

    Button1的

    <Button Command="{Binding Button1Command}">
    <StackPanel>
    <Image Source="button1.png"/>
    <TextBlock>Button2</TextBlock>
    </StackPanel>
    </Button>
    

    将Button2

    <Button Command="{Binding Button2Command}" Content="{Binding Button2Text}"/>
    

1 个答案:

答案 0 :(得分:0)

如果您不希望按钮成为窗口标签导航周期的一部分,请在按钮上设置Focusable to False

<Button Focusable="False"/>