WPF氣泡提示框的簡單制作
更新時間:2017年09月28日 14:49:19 作者:PettyHandSome
這篇文章主要為大家詳細介紹了WPF氣泡提示框的簡單制作,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了WPF氣泡提示框的具體代碼,供大家參考,具體內(nèi)容如下
直接上代碼
<TextBox Name="account" GotFocus="account_GotFocus" LostFocus="account_LostFocus" Style="{StaticResource LabelTextBox}" xl:ControlAttachProperty.Label="用戶名:" Foreground="Black" Margin="10,10,273,271" Width="Auto" />
先在前臺創(chuàng)建一個TextBox,然后各種附加的屬性加上去:如圖所示

<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="請輸入用戶名"/>
</StackPanel>
</Label>
</Popup>
效果圖:

樣式代碼:
<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>
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
.Net中導出數(shù)據(jù)到Excel(asp.net和winform程序中)
.Net中導出數(shù)據(jù)到Excel包括以下兩種情況:asp.net中導出Excel的方法/winForm中導出Excel的方法,針對以上兩種情況做了下詳細的實現(xiàn)代碼,感興趣的朋友可不要錯過了哈,希望本文對你有所幫助2013-02-02
ASP.NET開發(fā)者使用jQuery應該了解的幾件事情
如果你是有著APS.NET開發(fā)背景的人員,那么jQuery的幾個概念建議你應該忘掉。像使用其它的framework一樣,你應該學習一下jQuery的所有語法等約定來讓它更好的為你服務(wù)。2009-09-09

