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

How to set header for first tab?

Hi, I have DocumentContainer with HeaderTemplate set to this:

            <sf:DocumentContainer.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"
                                                   FontWeight="{Binding Modified,
                                                    Converter={StaticResource BoolToFontWeight}}"
                                         />
                </DataTemplate>
            </sf:DocumentContainer.HeaderTemplate>

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?


2 Replies

AD Adam 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;






JP Jagadeesan Pichaimuthu Syncfusion Team 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.  
   
Regards, 
Jagadeesan

Loader.
Live Chat Icon For mobile
Up arrow icon