WPF实现TextBlock呼吸灯效果
程序员文章站
2022-05-18 10:34:04
实现代码
实现代码
<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>