我有一個ListView水平呈現項目。每個項目是1列網格。外觀是列數爲動態的網格。所有這些工作,看起來像我想要的,除了標籤導航。我在ListView上設置了KeyboardNavigation.TabNavigation="Continue"
,並在ItemContainerStyle上將KeyboardNavigation.IsTabStop設置爲false,這允許我通過一個項目中的每一行,然後繼續到下一個項目等。但是,我希望從第一個在第一個項目中行到第二個項目中的第一個行,等等,然後到下一個行。列表視圖標籤導航列ListViewItems是網格列
Ex。
Item1Row1 - > Item2Row1 - > Item3Row1 - > ...
Item1Row2 - > Item2Row2 - > Item3Row2 - > ...
我已經建立了在控件的標籤索引每個單元格(我測試過的都是正確的),但我無法弄清楚我需要在ListView/ListViewItems中啓用TabIndexes的設置。任何幫助將不勝感激。這裏的xaml ...
<ListView VerticalAlignment="Top" Background="Transparent" BorderThickness="0" KeyboardNavigation.TabNavigation="Continue" ItemsSource="{Binding RawProductDataItemViewModels}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<Grid VerticalAlignment="Top" Margin="2.5,0,2.5,0">
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
<RowDefinition SharedSizeGroup="ButtonAndGridGroup"/>
</Grid.RowDefinitions>
<TextBlock Margin="5,4,0,0" Grid.Row="0">
<TextBlock.Text>
<MultiBinding StringFormat="Lane #{0}">
<Binding Path="Lane"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBox Grid.Row="1" Margin="0,4,0,0" Width="75" Text="{Binding RollNumber, StringFormat='{}{0:#####-#}', TargetNullValue=''}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=1}"/>
<TextBox Grid.Row="2" Margin="0,4,0,0" Width="75" Text="{Binding PCode}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=2}"/>
<TextBox Grid.Row="3" Margin="0,4,0,0" Width="75" Text="{Binding RollWidth}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=3}"/>
<TextBox Grid.Row="4" Margin="0,4,0,0" Width="75" Text="{Binding RollWeight}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=4}"/>
<TextBox Grid.Row="5" Margin="0,4,0,0" Width="75" Text="{Binding GrossWeight}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=5}"/>
<TextBox Grid.Row="6" Margin="0,4,0,0" Width="75" Text="{Binding BurnWeight}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=6}"/>
<TextBox Grid.Row="7" Margin="0,4,0,0" Width="75" Text="{Binding SqFtWeight}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=7}"/>
<TextBox Grid.Row="8" Margin="0,4,0,0" Width="75" Text="{Binding Cure}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=8}"/>
<TextBox Grid.Row="9" Margin="0,4,0,0" Width="75" Text="{Binding Rigidity}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=9}"/>
<TextBox Grid.Row="10" Margin="0,4,0,0" Width="75" Text="{Binding Telescope}"
TabIndex="{Binding Lane, Converter={StaticResource IntegersTo2DIndex}, ConverterParameter=10}"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>