views:

303

answers:

1

Hi, Im my tab control i want to set tooltip for all tab neaders. I coded like below

<TabItem.ToolTip>
<StackPanel Height="40" Width="70" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="center" > 
<Image VerticalAlignment="Top"  Width="30" Height="10" Source="Image\TAB2.png" Name="image2" />
 <TextBlock FontFamily="Aharoni" FontSize="11"  Foreground="Black" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="70" Text="Name Window" />
 </StackPanel>
</TabItem.ToolTip>

But the tolltip appears not only in header but in all tab page. I want to display the tooltip only on the mouse over on the tab header.

+1  A: 

Put the ToolTip on your TabItem.Header

<TabItem>
    <TabItem.Header>
        <Grid>
            <Grid.ToolTip>
                <StackPanel Height="40" Width="70" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="center" > 
                    <Image VerticalAlignment="Top"  Width="30" Height="10" Source="Image\TAB2.png" Name="image2" />
                    <TextBlock FontFamily="Aharoni" FontSize="11"  Foreground="Black" TextWrapping="Wrap" VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="70" Text="Name Window" />
                </StackPanel>
            </Grid.ToolTip>

            <TextBlock Text="Header" />
        </Grid>
    </TabItem.Header>

    <TextBlock Text="Tab Content" />
</TabItem>
qntmfred
yes,its working.Thank you.Pls answer me for this question.i want to use tab header as button also.can i do that?
Anu
not quite sure what you mean by that. You can put `Button` controls in your `TabItem.Header` if that's what you want.
qntmfred