其实很简单,只要将容器控件中的附加属性FocusManager.IsFocusScope设为True就可以了
下面是个简单的用例:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="" Width="">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=""/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="" Orientation="Horizontal" FocusManager.IsFocusScope="True">
<ComboBox Width="">
<ComboBoxItem></ComboBoxItem>
<ComboBoxItem></ComboBoxItem>
<ComboBoxItem></ComboBoxItem>
</ComboBox>
<ComboBox Width="">
<ComboBoxItem>a</ComboBoxItem>
<ComboBoxItem>b</ComboBoxItem>
<ComboBoxItem>c</ComboBoxItem>
</ComboBox>
</StackPanel>
<RichTextBox Grid.Row=""/>
</Grid>
</Window>
以下是运行效果图