Simple creation of WPF bubble prompt box, wpf bubble

Source: Internet
Author: User

Simple creation of WPF bubble prompt box, wpf bubble

The following example shows the code of the WPF bubble prompt box for your reference.

Directly Add code

<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:

<Popup Name = "pop3" AllowsTransparency = "True" StaysOpen = "True" PopupAnimation = "Fade" IsOpen = "False" PlacementTarget = "{Binding ElementName = account}" Placement =" right "> <Label Style =" {StaticResource tipLable} "> <StackPanel Orientation =" Horizontal "> <Label Content =" enter user name "/> </StackPanel> </Label> </Popup>

:

Style code:

<Style TargetType="Label" x:Key="tipLable">  <Setter Property="Template">   <Setter.Value>    <ControlTemplate TargetType="{x:Type Label}">     <Grid>      <Border CornerRadius="4" BorderBrush="Black" BorderThickness="1" VerticalAlignment="Top" Margin="8.5,0,0,0" Background="Yellow" HorizontalAlignment="Left" Padding="5">       <ContentPresenter />      </Border>      <Canvas Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,10,0,0" Background="Transparent">       <Path Stroke="Black" StrokeThickness="0.5" Fill="Yellow">        <Path.Data>         <PathGeometry Figures="M 10,0 L 10,0,0,5 L 0,5,10,10"/>        </Path.Data>       </Path>      </Canvas>     </Grid>    </ControlTemplate>   </Setter.Value>  </Setter> </Style>

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.