Click here to Skip to main content
Licence CPOL
First Posted 1 Nov 2009
Views 12,758
Bookmarked 11 times

WPF - Tooltip Property

By | 1 Nov 2009 | Article
This one we used on the most fundamental WPF controls Tooltip property and examines how to use features, features we will be trying to examine.

Developing applications with Windows Presentation Foundation can use the control palette of our business is large enough to comfortably walk. Tool box in the controls increased Framework and CodePlex, such as code.msdn web sites projects with the help to further increase is continuing. WPF in graphical and visual power of the everyday life of the control is also available through most simple applications, the most complex applications are given the opportunity to develop. 

This one we used on the most fundamental WPF controls Tooltip property and examines how to use features, features we will be trying to examine. 

WPF - Tooltip   

WPF application for end users and developing the components in the component palette and edit a lot you'll use. Have made our process works and what each control then click on what works and then prepare a document describing.However, among the world does not change the facts. End users do not read the documents easily prepared. This is the reason that the texts written on the clicks to be very careful Convectional choose and try to write text algınacak easily. However, with a maximum of two three words can describe what comes to mind words like that. Tooltip help in this case, we will grow. Control the mouse on a written explanation required üle we could stop, we can show pictures are very nice feature. Now, how to use this feature, let us begin to explain with the help of examples. 

Almost all of the controls with the mouse in the properties of the Tooltip property of a control point when information disclosure is a nice feature to show the wound. We want to be able to write a value to assign Tooltip will suffice. 

<Button Content="Submit">
    <Button.ToolTip>
        <ToolTip>
            <StackPanel>
                <TextBlock FontWeight="Bold">Submit</TextBlock>
                <TextBlock>Server on request..</TextBlock>
            </StackPanel>
        </ToolTip>
    </Button.ToolTip>
</Button> 

Tooltip property of the button control, we've added two adert TextBlock control and the mouse is over will allow to be displayed. Now run the project for testing purposes and the results are a look at. 

mak75_1_1.jpg

Seems to have realized we want. From the user when the button on the button that describes what works on a very short explanation is. 

Of course, in practice always be active at all in the form of kontorllerin is never a rule. In some cases, checks may be shown in passive state. But we have been passive in the control and that we were preparing a Tooltip always want to display. There needs to be done in this case TooltipService URLs into the circuit as shown in cases where Convectional Disable will allow. 

IsEnabled = "False" in cases where the checks TooltipService.ShowOnDisable = "True" feature using the Tooltip in'll allow to be displayed. 

<Button IsEnabled="False" ToolTip="Fill all areas..." ToolTipService.ShowOnDisabled="True" Content="Save" />

Passive control when the mouse pointer over the button, we would like the following screenshot. 

mak75_2_2.jpg
Fine. In cases where the buttons are active will continue to display Tooltip. However, we call if we cancel the service will experience Tooltip is not displayed. Tooltip 'feature in the other how much we are able to specify a time period can be displayed. For this TooltipService again. 'It is enough to take advantage of features in ShowDuration. 
<Button ToolTip="Fill all Areas..." ToolTipService.ShowDuration="20" Content="Save" /> 

We have written into the Tooltip text displayed on the screen after two seconds will be lost. 

mak75_3_3.jpg
Tooltip feature different scenarios very easy Somehow we have seen in kullanbildiğimizi. Now let's work deals with the visual side. We use the form on the windows of this type already used for all URLs we could. Practices, but not forget that we are developing with WPF, and this is presented to us teknlojinin visuals and flexibility we are able to use them all. Here we take advantage of this flexibility into the tooltip case i will a bit more visual. In the picture, and a tooltip will be outside of standard dimensions. 
 <Window x:Class="WPFControls.Tooltip"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Tooltip" Height="300" Width="300">
    <StackPanel>
        <Button Width="100" Height="30">Click Me...
            <Button.ToolTip>
                <StackPanel Background="Honeydew" Height="200" Width="200">
                    <StackPanel Background="BurlyWood" Height="30" Width="200" 
			Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" >
                        <Image VerticalAlignment="Top"  
				Width="30" Height="30" Source="Images/Copy.png" Name="image1" />
                        <TextBlock FontFamily="Aharoni" FontSize="24" FontWeight="Bold" Foreground="Black" TextWrapping="Wrap" 
			VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="143">
                            <Run FontFamily="Andalus" FontSize="18" FontWeight="Normal" Text="Hi, Everyone."/>
                        </TextBlock>
                    </StackPanel>
                    <StackPanel Width="200" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" >
                        <TextBlock TextWrapping="Wrap" 
				Foreground="#FFF9F4F4" TextAlignment="Center" Background="{x:Null}" 
				HorizontalAlignment="Right" VerticalAlignment="Top" Width="181" Height="98">
                          <Run FontFamily="Verdana" FontSize="11" FontWeight="Normal" Foreground="#FF151514" 
                               Text="Windows Presentation Foundation with building
<span class="Apple-tab-span" style="white-space: pre; ">				</span>perfect rich client application."/>
                        </TextBlock>
                    </StackPanel>
                </StackPanel>
            </Button.ToolTip>
        </Button>
    </StackPanel>
</Window> 

After we process the following screen will be. 

mak75_4_4.jpg
WPF a very simple way in using the power we have created a very slick Tooltip. We increased these examples according to the imagination and you have the opportunity. 

As a result of this summer, what we are doing end-user control help to explain one of the features of the WPF Tooltip control in using the power we have to review. 

I hope you able to be useful. 

Turhal Temizer 'in Blog

License

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

About the Author

TurhalTemizer

Software Developer (Senior)
Netron Technology
Turkey Turkey

Member

www.turhal.blogspot.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmemberbabai2823:49 23 Apr '12  
QuestionThe tooltip design seems to be plagiarized Pinmemberbabai2823:47 23 Apr '12  
GeneralMy vote of 1 PinmemberAngusP23:15 12 Dec '11  
GeneralMy vote of 1 PinmemberSercanOzdemir14:30 10 Dec '11  
GeneralMy vote of 1 PinmemberMember 38245762:52 3 Nov '09  
General[My vote of 1] I can't understand your article Pinmemberdisore2:48 3 Nov '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 1 Nov 2009
Article Copyright 2009 by TurhalTemizer
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid