We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set header for first tab?

Thread ID:





144154 Apr 22,2019 08:05 PM UTC Apr 23,2019 12:35 PM UTC WPF 2
Tags: DocumentContainer
Asked On April 22, 2019 08:05 PM UTC

Hi, I have DocumentContainer with HeaderTemplate set to this:

                    <TextBlock Text="{Binding Name}"
                                                   FontWeight="{Binding Modified,
                                                    Converter={StaticResource BoolToFontWeight}}"

And it works fine. But I want the first tab to show static header "Start". I thought it would be simple. Just add item into container and set sf:DocumentContainer.Header property. But it doesn't work. I tried also some datatriggers, but I failed. How to do it?

Replied On April 23, 2019 12:02 PM UTC

OK, from reply with other post I managed to solve it fast and easy in code behind.

First, we have to get DocumentTabControl from DocumentContainer:

tabControl = VisualUtils.FindDescendant(sender as Visual, typeof(DocumentTabControl)) as DocumentTabControl;

Then we have access to every tab. So for my is just:

//find template and add it to first item and add it to first item:
DataTemplate template = TryFindResource(templateKeyName) as DataTemplate;
TabItemExt item = tabControl.Items[0] as TabItemExt;
if(item != null)
  item.HeaderTemplate = template;

Jagadeesan Pichaimuthu [Syncfusion]
Replied On April 23, 2019 12:35 PM UTC

Hi Adam, 
Thanks for the update.  
We are glad to know that the reported problem has been resolved at your end using your workaround. Please let us know if you have any further queries on this. We are happy to help you.  


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon