zoukankan      html  css  js  c++  java
  • WPF 触发器(根据属性使用动画)

    1.是按钮的边框有闪烁的效果,是根据属性来设置的而非一般的事件

     1  <Style x:Key="PipesButtonStyle" TargetType="Button">
     2             <Setter Property="Height" Value="25"/>
     3             <Setter Property="IsHitTestVisible" Value="False"/>
     4             <Setter Property="Background" Value="Transparent"/>
     5             <Setter Property="Template">
     6                 <Setter.Value>
     7                     <ControlTemplate TargetType="{x:Type Button}">
     8                         <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" BorderBrush="Transparent" Background="{TemplateBinding Background}" RenderPressed="{TemplateBinding IsPressed}" RenderDefaulted="{TemplateBinding IsDefaulted}" SnapsToDevicePixels="true"/>
     9                     </ControlTemplate>
    10                 </Setter.Value>
    11             </Setter>
    12             <Setter Property="Effect">
    13                 <Setter.Value>
    14                     <DropShadowEffect x:Name="effect" BlurRadius="0" Color="Red" Direction="0"
    15                                       Opacity="0" RenderingBias="Performance" ShadowDepth="0"/>
    16                 </Setter.Value>
    17             </Setter>
    18             <Style.Triggers>
    19                 <Trigger Property="IsHitTestVisible" Value="true">
    20                     <Trigger.EnterActions>
    21                         <BeginStoryboard x:Name="enterStory">
    22                             <Storyboard>
    23                                 <DoubleAnimation Storyboard.TargetProperty="(FrameworkElement.Effect).(DropShadowEffect.BlurRadius)"
    24                                                  BeginTime="00:00:00" Duration="00:00:01"
    25                                                  From="0" To="10" 
    26                                                  AutoReverse="True" RepeatBehavior="Forever">
    27                                 </DoubleAnimation>
    28                                 <DoubleAnimation Storyboard.TargetProperty="(FrameworkElement.Effect).(DropShadowEffect.Opacity)"
    29                                                  BeginTime="00:00:00" Duration="00:00:00"
    30                                                  From="0" To="1" >
    31                                 </DoubleAnimation>
    32                             </Storyboard>
    33                         </BeginStoryboard>
    34                     </Trigger.EnterActions>
    35                     <Trigger.ExitActions>
    36                         <StopStoryboard BeginStoryboardName="enterStory">
    37                         </StopStoryboard>
    38                     </Trigger.ExitActions>
    39                 </Trigger>
    40             </Style.Triggers>
    41         </Style>

    2.遇到问题:如果我要感觉Content的值来设置Content的值是不行的,会报错。(错误原因为止,有待商榷)

  • 相关阅读:
    微信发送模板消息
    主从复制 读写分离
    php nginx反向代理
    go开发工具goclipse的安装
    安装go1.11.2
    基于科大讯飞AIUI平台自定义语义库的开发
    转载--php 7.2 安装 mcrypt 扩展
    mysql取出字段数据的精度
    sublime 2 格式化json
    RESTful接口需知道
  • 原文地址:https://www.cnblogs.com/XzcBlog/p/3054980.html
Copyright © 2011-2022 走看看