问题描述
我的计算机上安装了Windows 7.我有3个单选按钮的单选按钮组.我可以使用键盘的Tab键选择任何一个按钮,因此当我按下Tab键时,其他单选按钮将获得焦点.
I have window 7 installed on my machine. I have radio button group of 3 radio buttons. I can select any of those button using keyboard tab key, so when I press tab key, other radio button get focus.
但是当我将其主题从Windows 7更改为Windows经典主题时,当时的tab键不起作用.多次按Tab键后,下一个单选按钮未获得焦点.其他控件正确突出显示,只有单选按钮不起作用.
But when I changed it's theme from windows 7 to windows classic theme, at that time tab key does not work. Next radio button is not getting focus after i press Tab key several times. Other control are highlighting correctly, only radio button does not work.
这是单选按钮代码
< RadioButton Grid.Row ="1" Grid.Column ="0".保证金="5,0,0,0&"; x:Name ="rbtnMLayout"; IsChecked ="{绑定路径= IsLayoutMaintained,模式=双向,转换器= {StaticResource enumBooleanConverter},ConverterParameter = MaintaintLayout}". IsEnabled ="{绑定IsEmptyFile,转换器= {StaticResource OppositeBoolConverter}}" KeyboardNavigation.IsTabStop ="True" TabIndex ="1">
< StackPanel Orientation =水平"; VerticalAlignment =中心". HorizontalAlignment =左">
< TextBlock Margin =" 3,0,0,0"文本="{x:静态loc:DataRecallLoc.MaintaintLayout}" VerticalAlignment =中心". Style ="{{DynamicResource ContentNormalFontStyle}"//>
</StackPanel>
</RadioButton>
<RadioButton Grid.Row="1" Grid.Column="0" Margin="5,0,0,0" x:Name="rbtnMLayout" IsChecked="{Binding Path=IsLayoutMaintained, Mode=TwoWay, Converter={StaticResource enumBooleanConverter}, ConverterParameter=MaintaintLayout}" IsEnabled="{Binding IsEmptyFile, Converter={StaticResource OppositeBoolConverter}}" KeyboardNavigation.IsTabStop="True" TabIndex="1">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Margin="3,0,0,0" Text="{x:Static loc:DataRecallLoc.MaintaintLayout}" VerticalAlignment="Center" Style="{DynamicResource ContentNormalFontStyle}"/>
</StackPanel>
</RadioButton>
< RadioButton Grid.Row ="2" x:Name ="rbtn2"; Grid.Column ="0".保证金="5,4,0,0&". IsChecked =""{Binding Path = IsLayoutMaintained,Mode = TwoWay,Converter = {StaticResource enumBooleanConverter},ConverterParameter = DistributeLayoutForCellCount}"
IsEnabled ="{绑定IsEmptyFile,Converter = {StaticResource OppositeBoolConverter}}" KeyboardNavigation.IsTabStop ="True" TabIndex ="2". VerticalContentAlignment =顶部">
< StackPanel Orientation =水平"; VerticalAlignment =顶部" HorizontalAlignment =左">
......一些代码
</StackPanel>
</RadioButton>
<RadioButton Grid.Row="2" x:Name="rbtn2" Grid.Column="0" Margin="5,4,0,0" IsChecked="{Binding Path=IsLayoutMaintained, Mode=TwoWay, Converter={StaticResource enumBooleanConverter}, ConverterParameter=DistributeLayoutForCellCount}"
IsEnabled="{Binding IsEmptyFile, Converter={StaticResource OppositeBoolConverter}}" KeyboardNavigation.IsTabStop="True" TabIndex="2" VerticalContentAlignment="Top">
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
............... some code
</StackPanel>
</RadioButton>
< RadioButton x:Name =" rbtn3" Grid.Row ="3". Grid.Column ="0".保证金="5,4,0,0&". IsChecked ="{绑定路径= IsLayoutMaintained,模式=双向,转换器= {StaticResource enumBooleanConverter},ConverterParameter = DistributeLayout}"; IsEnabled ="{绑定IsEmptyFile,转换器= {StaticResource OppositeBoolConverter}}" KeyboardNavigation.IsTabStop ="True" TabIndex ="4">
< StackPanel Orientation =水平"; VerticalAlignment =中心". HorizontalAlignment =左">
< TextBlock Margin =" 3,0,0,0"文本="{x:静态loc:DataRecallLoc.DistributeLayout}" VerticalAlignment =中心". Style ="{{DynamicResource ContentNormalFontStyle}"//>
</StackPanel>
</RadioButton>
<RadioButton x:Name="rbtn3" Grid.Row="3" Grid.Column="0" Margin="5,4,0,0" IsChecked="{Binding Path=IsLayoutMaintained, Mode=TwoWay, Converter={StaticResource enumBooleanConverter}, ConverterParameter=DistributeLayout}" IsEnabled="{Binding IsEmptyFile, Converter={StaticResource OppositeBoolConverter}}" KeyboardNavigation.IsTabStop="True" TabIndex="4">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Margin="3,0,0,0" Text="{x:Static loc:DataRecallLoc.DistributeLayout}" VerticalAlignment="Center" Style="{DynamicResource ContentNormalFontStyle}"/>
</StackPanel>
</RadioButton>
请帮助
谢谢
Dee
推荐答案
我想应该是表格吗?表格中还有其他项目吗?表单是第一次集中显示吗?
i suppose it wold be a form? Do you have many more items in the form? is the form focused in the first time?
如果表单中还有更多项目,则应按照您要在项目中圈出的顺序重新排列tabindex的顺序.
if you have more items in the form you should reorder the tabindex in the order you want to circle through the items.
让我们知道更多详细信息.
Let us know more details.
这篇关于通过Windows经典主题中的Tab键进行导航时,WPF单选按钮未突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!