Click here to Skip to main content
12,244,041 members (50,173 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# WPF
Hi!
what I'm trying to do is showing tool tip only on tab name (like in browsers), not on whole tab grid. I've searched Google but i have not found nothing interesting. Any idea how to do that?
Posted 3-Dec-12 6:14am
Tapirro354
Edited 3-Dec-12 6:15am
v3
Comments
Sanket Panchamia 28-May-13 11:32am
   
I have a code that is as follows







I am not getting the tooltip text. Any comments?
Tapirro 28-May-13 12:07pm
   
Any error or warnings comming from Visual? For me this solution works perfectly.
Sanket Panchamia 28-May-13 12:29pm
   
just no tooltip. Thats it

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You are likely setting it on the Tab not the header. Try the header instead. This may require you to restyle the header.
You can restyle the header how ever you want though and then set the tooltip for the UI element you use to display the header.

Something like this should work.

Note: this was not tested so there may be errors in it.

<TabControl x:Name="tabCtrlMain" ItemsSource="{Binding Items}" >
        <TabControl.Resources>
            <Style TargetType="TabItem">
                <Setter Property="Header" Value="{Binding FileName}" />
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <DataTemplate DataType="{x:Type TabItem}">
                            <Border x:Name="grid">
                                    <ContentPresenter>
                                        <ContentPresenter.Content>
                                            <TextBlock Text="{TemplateBinding Content}" Tooltip="{Binding Path=TooltInfo}"/>
                                        </ContentPresenter.Content>
                                    </ContentPresenter>
                                </Border>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </TabControl.Resources>
    </TabControl>

If you are directly adding tabs in XAML then just code right to the header.

i.e.

<TabItem>
    <TabItem.Header>
        <Grid>
            <Grid.ToolTip>
                <!--Place your tooltip content here-->
            </Grid.ToolTip>
 
        </Grid>
    </TabItem.Header>
 
</TabItem>
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100