I have ControlTemplate (XAML).
I need in code behid add ControlTemplate to TabItem.Content.
var tabItem = new TabItem
{
DataContext = listDesk,
Header = headerText,
Content = ???
};
XAML
<ControlTemplate x:Key="MyTabItemContentTemplate" TargetType="controls:TabItem">
<StackPanel>
<TextBlock Text="wwwwww"/>
</StackPanel>
</ControlTemplate>
I use SL4
I think you’re confusing concepts. Instead of setting the
Content, which is data, set theTemplate, which is the visual representation of the control:Moreover, chances are there is no reason to do this in code. You could be doing it entirely in XAML.