2013-12-22 95 views
0

上文本禁用標籤導航我有以下兩個按鈕:WPF內部按鈕

  1. Button1的 將Button2

  2. 將Button2

在的情況下, button1 the st內部的ackpannel得到關注。 在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}"/> 
+0

請問您可以在問題中發佈您的代碼嗎?它會讓我們更容易給你一個有用的答案 – yochannah

回答

0

如果你不想按鍵是你的窗口的標籤導航循環的一部分,在您的按鈕設置Focusable to False

<Button Focusable="False"/> 
+0

該按鈕應該是可以調焦的。我按標籤,按鈕變得焦點,很酷。如果我再次按Tab鍵,焦點移動到按鈕內部的文本中......這是我想擺脫的行爲。 – srg

+0

使用此聲明'