欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

WPF中textBlock 变色功能

程序员文章站 2022-05-26 23:42:03
......
       
  <window.resources>
 <storyboard x:key="onloaded" repeatbehavior="forever" autoreverse="true"  >
            <coloranimationusingkeyframes storyboard.targetproperty="(foreground).(solidcolorbrush.color)" storyboard.targetname="btn_register">
                <easingcolorkeyframe keytime="0:0:1" value="lightblue"/>
                <easingcolorkeyframe keytime="0:0:2" value="lightgreen"/>
            </coloranimationusingkeyframes>
        </storyboard>
    </window.resources>
    <window.triggers>
        <eventtrigger routedevent="frameworkelement.loaded">
            <beginstoryboard  storyboard="{staticresource onloaded}"/>
        </eventtrigger>
    </window.triggers>
<button
                    name="btn_register"
                    margin="62,26,-60,2"
                    content="新用户注册"
                    command="{binding path=registercmd}"
foreground="#ff91b9ea" grid.column="2" width="auto" fontweight="bold" fontsize="14"/>