When using the itemsControl it does not set the parent for any child control created in the DataTemplate section.
Which makes it impossible for the Zorder to have any real meaning.
I'm basically creating a custom tab control, but the following line does not actully set the zorder becuase I guess it has no real reference to any other control on the page.
selectedTab.SetValue(Canvas.ZIndexProperty, 1);
Any ideas of what I can do to make sure the controls have a parent?
<ItemsControl x:Name="itemsControl"
Width="Auto"
Height="Auto"
ItemsSource="{Binding SubNavigationButtons}">
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<StackPanel RenderTransformOrigin="0.5,0.5" Margin="0 44 0 0">
<StackPanel.RenderTransform>
<CompositeTransform Rotation="180"/>
</StackPanel.RenderTransform>
<ItemsPresenter />
</StackPanel>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding Path=TabText, Converter={StaticResource SubNavigationTextConverter}}"
Style="{StaticResource RadioButtonStyle_Tab}"
IsChecked="{Binding Path=., Converter={StaticResource IsDefaultTabConverter}}"
GroupName="TabGroup"
Tag="{Binding Path=Tag}"
Click="UXTab_Checked">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<Media:PlaySoundAction Source="{Binding Path=SoundFile}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</RadioButton>
</DataTemplate >
</ItemsControl.ItemTemplate>
</ItemsControl>