Reputation: 3735
I have a "Listview", such this:
<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>
now the focus navigates the items with CTRL + TAB combination key, but i want handle and replace just TAB key instead of it. How can i do this?
Upvotes: 1
Views: 147
Reputation: 12295
try this
<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>
Set KeyboardNavigation.TabNavigation="Continue" KeyboardNavigation.ControlTabNavigation="None" of ListView . Hope this will help. I have tried it and it worked.
Upvotes: 1