Simple implementation of WPF bubble prompt box and wpf bubble implementation

Source: Internet
Author: User

Simple implementation of WPF bubble prompt box and wpf bubble implementation

I dug a big hole myself, and then I was forced to rewrite the code style! Not much waste

Directly Add code

1 <TextBox Name = "account" GotFocus = "account_GotFocus" LostFocus = "account_LostFocus" Style = "{StaticResource LabelTextBox}" xl: ControlAttachProperty. label = "username:" Foreground = "Black" Margin = "273,271," Width = "Auto"/>

Create a TextBox at the front end, and add the following attributes to the additional attributes:

1 <Popup Name = "pop3" AllowsTransparency = "True" StaysOpen = "True" PopupAnimation = "Fade" IsOpen = "False" PlacementTarget = "{Binding ElementName = account}" Placement = ""Right"> 2 <Label Style = "{StaticResource tipLable}"> 3 <StackPanel Orientation = "Horizontal"> 4 <Label Content = "Enter the user name"/> 5 </ stackPanel> 6 </Label> 7 </Popup>

 

:

 

Style code:

 1    <Style TargetType="Label" x:Key="tipLable"> 2         <Setter Property="Template"> 3             <Setter.Value> 4                 <ControlTemplate TargetType="{x:Type Label}"> 5                     <Grid> 6                         <Border CornerRadius="4" BorderBrush="Black" BorderThickness="1" VerticalAlignment="Top" Margin="8.5,0,0,0" Background="Yellow" HorizontalAlignment="Left" Padding="5"> 7                             <ContentPresenter /> 8                         </Border> 9                         <Canvas Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10,0,0" Background="Transparent">10                             <Path Stroke="Black" StrokeThickness="0.5" Fill="Yellow">11                                 <Path.Data>12                                     <PathGeometry Figures="M 10,0 L 10,0,0,5  L 0,5,10,10"/>13                                 </Path.Data>14                             </Path>15                         </Canvas>16                     </Grid>17                 </ControlTemplate>18             </Setter.Value>19         </Setter>20     </Style>

Original Source: http://www.cnblogs.com/PettyHandSome/

You are welcome to repost the article, but without the consent of the authorThe author and the original article must be clearly connected on the article page.Otherwise, the system reserves the right to pursue legal liability.

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.