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:  2431 
Posted On:  24/11/2013 11:16:50 
How we can use fancy tool tip, How we can customize too tip in WPF ? 

 

In this article I am going to show how we can customize Tool Tip of any control in WPF. WPF provide a power full feature to customize too tip.

In WPF Tool Tip property can host any kind of controls ie: rectangle, text block, or a panel.

Let see by creating some example:

Exp # 1:

        <Button Width="100" Height="30">Submit
            <Button.ToolTip>
                <ToolTip>Click Here To Submit.
                </ToolTip>
            </Button.ToolTip>
        </Button> 

Tool Tip 1.png

Image 1.

Exp # 2

<
Button Width="100" Height="30">Submit
            <Button.ToolTip>
                <ToolTip>
                    <StackPanel>
                        <TextBlock FontWeight="Bold">Submit Request</TextBlock>
                        <TextBlock>Submit All Your Request.</TextBlock>
                    </StackPanel>
                </ToolTip>
            </Button.ToolTip>
        </Button>

Tool Tip 2.png

Image 2.

Exp# 3:

   
<Button Width="100" Height="30">Submit
            <Button.ToolTip>
                <ToolTip>
                    <Border Margin="-4,0,-4,-3" Padding="10" Background="SkyBlue">
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect></OuterGlowBitmapEffect>
                        </Border.BitmapEffect>
                        <Label>Submit Request on Click.</Label>
                    </Border>
                </ToolTip>
            </Button.ToolTip>
        </Button>

Tool Tip 3.png

Image 3.

Exp # 4:

Normally  we see Tool Tip is appear only where our mouse pointer. If we want to display a Tool Tip at a particular position then we can do it by using
ToolTipService. We can use ToolTipService.Placement property to our custom location. Let see in below example:

<Button Width="100" Height="30" ToolTipService.Placement="Bottom">Submit
            <Button.ToolTip>
                <ToolTip>
                    <Border Margin="-4,0,-4,-3" Padding="10" Background="SkyBlue">
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect></OuterGlowBitmapEffect>
                        </Border.BitmapEffect>
                        <Label>Submit Request on Click.</Label>
                    </Border>
                </ToolTip>
            </Button.ToolTip>
        </Button>

Tool Tip 4.png

Image 4.

Exp # 5:

In WPF we can show ToolTip even if control is disable by using
ToolTipService.ShowOnDisabled="True"

<Button Width="100" Height="30" ToolTipService.ShowOnDisabled="True" IsEnabled="False">Submit
            <Button.ToolTip>
                <ToolTip>
                    <Border Margin="-4,0,-4,-3" Padding="10" Background="SeaGreen">
                        <Border.BitmapEffect>
                            <OuterGlowBitmapEffect></OuterGlowBitmapEffect>
                        </Border.BitmapEffect>
                        <Label>Submit Request on Click.</Label>
                    </Border>
                </ToolTip>
            </Button.ToolTip>
        </Button>

Tool Tip 5.png

Image 5.

Exp # 6 :

We can set show delay time and we can also set time duration mean for how much time this tool tip should show:

<Button Width="100" Height="30"  ToolTipService.HasDropShadow="False"
       ToolTipService.InitialShowDelay="200"
        ToolTipService.ShowDuration="5000"
        ToolTipService.ShowOnDisabled="True"> 
.....
</
Button>
 

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