I have following code -
<ContentControlKeyboardNavigation.TabIndex="6">//Point A
<ContentControl.Template>
<ControlTemplate>
<ContentControl x:Name="content">
<ContentControl.Template>
<ControlTemplate>
<ComboBoxStyle="{StaticResource ComboBoxStyle}"ItemsSource="{Binding Path=Property1}"
Margin="0, 7">
<ComboBox.SelectedValue>
<BindingPath="PropertyText"/>
</ComboBox.SelectedValue>
</ComboBox>
</ControlTemplate>
</ContentControl.Template>
</ContentControl>
<ControlTemplate.Triggers>
<DataTriggerBinding="{Binding Path=Property1}"Value="val1">
<SetterTargetName="content"Property="Template">
<Setter.Value>
<ControlTemplate>
<ComboBoxStyle="{StaticResource ComboBoxStyle}"ItemsSource="{Binding Path=Propert2}"
Margin="0, 7">
<ComboBox.SelectedValue>
<BindingPath="val2"/>
</ComboBox.SelectedValue>
</ComboBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ContentControl.Template>
</ContentControl>
Explanation
See the Point A at first line of code. The TabIndex is working fine, but if I move this to internal elements like ComboBox, it goes to next TabIndex. Also I have a trigger which changes Template on corresponding trigger.
Requirement
Whichever Combobox is visible should get TabIndex="6".
The parent control i.e. ContentControl should not get any TabIndex.
Please suggest some solution.
I have tried KeyboardNavigation.TabNavigation property but is not providing any solution.