.net “如何分配”;标签";键而不是“键”;Ctrl+;标签";输入ListView?
我有一个“列表视图”,例如:.net “如何分配”;标签";键而不是“键”;Ctrl+;标签";输入ListView?,.net,wpf,.net,Wpf,我有一个“列表视图”,例如: <ListView ItemsSource="{Binding ...}" > <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
<ListView ItemsSource="{Binding ...}" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinWidth" Value="50"/>
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="true">
<Setter Property="IsSelected" Value="true" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding ... }" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
现在,焦点使用CTRL+TAB组合键导航项目,但我希望只处理和替换TAB键而不是它。
我该怎么做呢?试试这个
<ListView ItemsSource="{Binding Student}" KeyboardNavigation.TabNavigation="Continue" KeyboardNavigation.ControlTabNavigation="None" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinWidth" Value="50"/>
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="true">
<Setter Property="IsSelected" Value="true" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Name }" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
设置ListView的KeyboardNavigation.TabNavigation=“Continue”KeyboardNavigation.ControlTabNavigation=“None”。希望这会有所帮助。我已经试过了,效果很好。试试这个
<ListView ItemsSource="{Binding Student}" KeyboardNavigation.TabNavigation="Continue" KeyboardNavigation.ControlTabNavigation="None" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinWidth" Value="50"/>
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="true">
<Setter Property="IsSelected" Value="true" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"></StackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Name }" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
设置ListView的KeyboardNavigation.TabNavigation=“Continue”KeyboardNavigation.ControlTabNavigation=“None”。希望这会有所帮助。我已经试过了,而且成功了