L
Lloyd Dupont
Here is a XAML snippet (which would run in XAML Pad as well):
<TabControl>
<TabItem Header="One">
<TabControl>
<TabItem Header="OK">
<Button Content="OK"/>
</TabItem>
<TabItem Header="Not OK">
<Button Content="Not OK"/>
</TabItem>
</TabControl>
</TabItem>
<TabItem Header="Two">
<TabControl>
<TabControl.Template>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local"
SnapsToDevicePixels="true" ClipToBounds="true">
<Grid.RowDefinitions>
<RowDefinition Name="RowDefinition0"
Height="Auto" />
<RowDefinition Name="RowDefinition1" Height="*"
/>
</Grid.RowDefinitions>
<DockPanel>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal"
Name="HeaderPanel" ZIndex="1" KeyboardNavigation.TabIndex="1"
IsItemsHost="true" />
<Label Content="Something" />
</DockPanel>
<ContentPresenter Name="PART_SelectedContentHost"
Grid.Column="0" Grid.Row="1" SnapsToDevicePixels="{TemplateBinding
SnapsToDevicePixels}" Margin="{TemplateBinding Padding}"
ContentSource="SelectedContent" />
</Grid>
</ControlTemplate>
</TabControl.Template>
<TabItem Header="Apple">
<Button Content="One Apple a day, keep the doctors away"/>
</TabItem>
<TabItem Header="Carrot">
<Button Content="One carrot a day, ho well, nothing special"/>
</TabItem>
</TabControl>
</TabItem>
</TabControl>
Where every time you select the TabItem "Two" (in the toplevel tab) the
inner TabControl would change its selected item.
(every second time it will be "Apple" every other second time it will be
"Carrot")
Why does the inner tab changes?
How to work around this bug?
<TabControl>
<TabItem Header="One">
<TabControl>
<TabItem Header="OK">
<Button Content="OK"/>
</TabItem>
<TabItem Header="Not OK">
<Button Content="Not OK"/>
</TabItem>
</TabControl>
</TabItem>
<TabItem Header="Two">
<TabControl>
<TabControl.Template>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local"
SnapsToDevicePixels="true" ClipToBounds="true">
<Grid.RowDefinitions>
<RowDefinition Name="RowDefinition0"
Height="Auto" />
<RowDefinition Name="RowDefinition1" Height="*"
/>
</Grid.RowDefinitions>
<DockPanel>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal"
Name="HeaderPanel" ZIndex="1" KeyboardNavigation.TabIndex="1"
IsItemsHost="true" />
<Label Content="Something" />
</DockPanel>
<ContentPresenter Name="PART_SelectedContentHost"
Grid.Column="0" Grid.Row="1" SnapsToDevicePixels="{TemplateBinding
SnapsToDevicePixels}" Margin="{TemplateBinding Padding}"
ContentSource="SelectedContent" />
</Grid>
</ControlTemplate>
</TabControl.Template>
<TabItem Header="Apple">
<Button Content="One Apple a day, keep the doctors away"/>
</TabItem>
<TabItem Header="Carrot">
<Button Content="One carrot a day, ho well, nothing special"/>
</TabItem>
</TabControl>
</TabItem>
</TabControl>
Where every time you select the TabItem "Two" (in the toplevel tab) the
inner TabControl would change its selected item.
(every second time it will be "Apple" every other second time it will be
"Carrot")
Why does the inner tab changes?
How to work around this bug?