J'ai une fenêtre simple avec un contrôle composite simple intégré dedans.WPF TabIndex dans une commande composite
(fenêtre principale)
<Window x:Class="TabOrder.Window1"
xmlns:local="clr-namespace:TabOrder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Label HorizontalAlignment="Left" VerticalAlignment="Top">First</Label>
<TextBox TabIndex="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="80,0,0,0"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,30,0,0">Second</Label>
<TextBox TabIndex="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="80,30,0,0"/>
<local:MyControl Margin="0,60,0,0" VerticalAlignment="Top" HorizontalAlignment="Stretch" TabIndex="2"/>
</Grid>
(contrôle composite)
<UserControl x:Class="TabOrder.MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Label HorizontalAlignment="Left" VerticalAlignment="Top">Third</Label>
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="80,0,0,0"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,30,0,0">Fourth</Label>
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="80,30,0,0"/>
</Grid>
Comme prévu sur ma forme, je reçois 4 zones de texte ...
- Première
- Deuxième
- Troisième
- Quatrième
Mais quand "d'abord" a le focus et je frappe l'onglet mise au point est réglé sur "troisième". WPF semble voir la liste d'onglets comme une simple liste plate plutôt que comme un arbre où MyControl est TabIndex 3 et la zone de texte "Third" le premier contrôle à onglets dedans.
Est-ce un bug dans WPF ou existe-t-il un autre moyen de le faire? Le contrôle composite est utilisé dans de nombreuses fenêtres, il pourrait même être utilisé plus d'une fois sur une seule fenêtre.
Il n'est pas trop tard pour moi. Merci. – zgnilec