Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Tooltip in wpf

Article:
Viewed:  1399 
Posted On:  12/06/2013 11:19:16 
How we can show Tooltip in WPF? How we can customized Tooltip in WPF? 

In this article I am going to show how we can customized tool tip in WPF.

<Window x:Class="ToolTip_In_WPF.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ToolTip In WPF" Height="300" Width="300">
    <Grid>
        <Button Width="100" Height="30">Click Me
            <Button.ToolTip>
                <ToolTip>Click Me To Show Result.
                </ToolTip>
            </Button.ToolTip>
        </Button>
    </Grid>
</Window>

1.png

Image 1.

We can host a ToolTip in any controls like in below example I am going to host tooltip in stack panel.

<Button Width="130" Height="30">Click Me
            <Button.ToolTip>
                <StackPanel Background="RoyalBlue" Height="200" Width="250">
                    <StackPanel Background="DarkOrange" Height="30" Width="240" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" >
                        <Image VerticalAlignment="Top"  Width="100" Height="35" Source="donetsg.png" Name="image1" />
                        <TextBlock FontFamily="Aharoni" FontSize="24" FontWeight="Bold" Foreground="Black" TextWrapping="Wrap"
                                   VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="193">
                            <Run FontFamily="Andalus" FontSize="18" FontWeight="Normal" Text="Welcome To DotnetCodeSG.com"/>
                        </TextBlock>
                    </StackPanel>
                    <StackPanel Width="200" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" >
                        <TextBlock TextWrapping="Wrap" Foreground="#FFF9F4F4" TextAlignment="Center" Background="{x:Null}" HorizontalAlignment="Right"
erticalAlignment="Top" Width="181" Height="98">
                          <Run FontFamily="Verdana" FontSize="11" FontWeight="Normal" Foreground="#FF151514"
                               Text="WELCOME to DotNetCodeSG.com can share your views and knowledge. "/>
                        </TextBlock>
                    </StackPanel>
                </StackPanel>
            </Button.ToolTip>
        </Button>

2.png

Image 2.

We can also set the time duration of tooltip..

<Button ToolTip="Hi All" Width="100" Height="100"
        ToolTipService.ShowDuration="90"
        Content="Click Me">
        </Button>

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us