0
我已将它设置为F1,F3,F7三个按钮。问题是,在按下按钮之前必须集中按钮F1或F3 ... 我想在键盘上使用TAB以在按钮之间进行对焦。如何在wpf中按Tab键时在按钮(焦点)之间导航?
<Grid Grid.Row="0" Background="#373737">
<StackPanel Orientation="Horizontal" Margin="0,0,0,1">
<Button x:Name="btnPay" FontSize="13" FontWeight="ExtraBold" Margin="0,0,1,0" BorderThickness="0" Width="120" KeyDown="btnPay_KeyDown">
<StackPanel Orientation="Vertical">
<Image Source="/Image/receipt.png" Width="40" Height="40" />
<TextBlock VerticalAlignment="Center" Margin="5,0" Foreground="White">Thanh toán (F1)</TextBlock>
</StackPanel>
</Button>
<Button x:Name="btnClear" FontSize="13" FontWeight="ExtraBold" Margin="0,0,1,0" BorderThickness="0" Width="120" KeyDown="btnClear_KeyDown">
<StackPanel Orientation="Vertical">
<Image Source="/Image/eraser.png" Width="40" Height="40" />
<TextBlock VerticalAlignment="Center" Margin="5,0" Foreground="White">Xóa (F2)</TextBlock>
</StackPanel>
</Button>
</StackPanel>
<Button x:Name="btnLogOut" FontSize="13" FontWeight="ExtraBold" Width="120" Margin="0,0,1,1" BorderThickness="0" KeyDown="btnLogOut_KeyDown"
HorizontalAlignment="Right">
<StackPanel Orientation="Vertical">
<Image Source="/Image/password.png" Width="40" Height="40" />
<TextBlock VerticalAlignment="Center" Margin="5,0" Foreground="White">Log Out (F6)</TextBlock>
</StackPanel>
</Button>
</Grid>
默认情况下,“选项卡”将焦点元素更改为下一个。你可以在这里用按钮发布XAML吗?按钮上的相同布局有没有其他控件? –
已上传的xaml ... –
您的意思是,按F1会对'播放'执行操作,按下F2,对'Xóa'执行操作,然后按下F6对'注销'执行操作?是这样吗? –