WPF-004 control ToolTip

Source: Internet
Author: User

The tooltip in WPF (the stuff popped up with the mouse over a control) is easy to use. 1. Complex ToolTip prompts not only contain text and images, but also use the ToolTip attribute to add controls to the attribute. As follows: [html] <! -- Complex tooltip --> <Button Height = "25" Content = "prompt tool Demo" HorizontalAlignment = "Center"> <Button. toolTip> <ToolTip Background = "#60AA4030" Foreground = "White" HasDropShadow = "False" Placement = "Mouse"> <StackPanel> <TextBlock Margin = "3"> tips: what is this? </TextBlock> <Image Source = "Image/kengdiede12306.jpg" Stretch = "Fill"/> <TextBlock Margin = "3"> the legendary 0.3 billion website. </TextBlock> </StackPanel> </ToolTip> </Button. ToolTip> </Button> <! -- Complex tooltip --> <Button Height = "25" Content = "prompt tool Demo" HorizontalAlignment = "Center"> <Button. toolTip> <ToolTip Background = "#60AA4030" Foreground = "White" HasDropShadow = "False" Placement = "Mouse"> <StackPanel> <TextBlock Margin = "3"> tips: what is this? </TextBlock> <Image Source = "Image/kengdiede12306.jpg" Stretch = "Fill"/> <TextBlock Margin = "3"> the legendary 0.3 billion website. </TextBlock> </StackPanel> </ToolTip> </Button. ToolTip> </Button> effect: the Placement attribute is generally modified to modify the location of the prompt. 2. for plain text prompts, you do not need to add controls. You can directly write them in the toolTip attribute. [Html] <Button Width = "200" Height = "50" Content = "ToolTip attribute demonstration" Grid. Row = "2" ToolTip = "plain text TollTip. "HorizontalAlignment =" Center "> </Button> <Button Width =" 200 "Height =" 50 "Content =" ToolTip attribute demonstration "Grid. row = "2" ToolTip = "Use the plain text TollTip. "HorizontalAlignment =" Center "> </Button> effect: 3. You cannot use the ToolTip attribute. If a control does not have the ToolTip attribute, you can use the ToolTipService attribute. [Html] <Button Width = "200" Height = "50" Grid. row = "1" Content = "ToolTipService Demo" HorizontalAlignment = "Center" ToolTipService. initialShowDelay = "1" ToolTipService. toolTip = "ToolTipService"> </Button> <Button Width = "200" Height = "50" Grid. row = "1" Content = "ToolTipService Demo" HorizontalAlignment = "Center" ToolTipService. initialShowDelay = "1" ToolTipService. toolTip = "ToolTipService"> </Button> effect:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.