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

WPF实现TextBlock呼吸灯效果

程序员文章站 2022-10-29 11:38:07
实现代码

WPF实现TextBlock呼吸灯效果

 

实现代码

                            <textblock text="录像中" fontsize="48" foreground="#ed4646" horizontalalignment="center" fontweight="medium" x:name="textblockrecording">
                                <textblock.triggers>
                                    <eventtrigger routedevent="frameworkelement.loaded">
                                        <beginstoryboard>
                                            <storyboard begintime="0:0:0" duration="0:0:5" autoreverse="true" repeatbehavior="forever">
                                                <coloranimation from="#ed4646" to="#f0f2f7" repeatbehavior="forever" storyboard.targetproperty="(textblock.foreground).(solidcolorbrush.color)" storyboard.targetname="textblockrecording">
                                                </coloranimation>
                                            </storyboard>
                                        </beginstoryboard>
                                    </eventtrigger>
                                </textblock.triggers>
                            </textblock>

textbox关闭中文输入法:

引用:xmlns:input="clr-namespace:system.windows.input;assembly=presentationcore"

<textbox x:name="textboxsctm" style="{staticresource textboxextend}" controls:infoelement.placeholder="扫码" horizontalalignment="right" height="35" width="100" verticalalignment="center" margin="10,0,0,0" keydown="textboxsctm_onkeydown" input:inputmethod.isinputmethodenabled="false"></textbox>