当前位置: 移动技术网 > IT编程>开发语言>.net > WPF气泡提示框的简单制作

WPF气泡提示框的简单制作

2017年10月07日  | 移动技术网IT编程  | 我要评论

湖南卫视天天向上直播,苹果图片大全,杜学芳

本文实例为大家分享了wpf气泡提示框的具体代码,供大家参考,具体内容如下

直接上代码

<textbox name="account" gotfocus="account_gotfocus" lostfocus="account_lostfocus" style="{staticresource labeltextbox}" xl:controlattachproperty.label="用户名:" foreground="black" margin="10,10,273,271" width="auto" />

先在前台创建一个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>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网