加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Blink.xaml 2.68 KB
一键复制 编辑 原始数据 按行查看 历史
Broadm 提交于 2023-08-11 13:46 . 添加项目文件。
<Window
x:Class="TimeCountDown.Blink"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:TimeCountDown"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Blink"
Width="800"
Height="450"
mc:Ignorable="d">
<Window.Resources>
<Style TargetType="Label">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="0">
<Setter Property="Background" Value="Green">
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="1">
<Setter Property="Background" Value="Red">
</Setter>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag}" Value="2">
<DataTrigger.EnterActions>
<BeginStoryboard Name="Shine">
<Storyboard RepeatBehavior="Forever">
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Background.Color">
<EasingColorKeyFrame KeyTime="0" Value="Red">
</EasingColorKeyFrame>
<EasingColorKeyFrame KeyTime="0:0:0.5" Value="Green">
</EasingColorKeyFrame>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<StopStoryboard BeginStoryboardName="Shine" />
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<StackPanel HorizontalAlignment="Center">
<Label
Width="81"
Height="45"
Margin="5"
Foreground="White"
Tag="0" />
<Label
Width="81"
Height="45"
Margin="5"
Foreground="White"
Tag="1" />
<Label
Width="81"
Height="45"
Margin="5"
Background="Green"
Foreground="White"
Tag="2" />
</StackPanel>
</Grid>
</Window>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化