首页 > 代码库 > WPF为提示信息文本增加闪烁效果
WPF为提示信息文本增加闪烁效果
程序通常需要显示某些提醒用户警示的信息,如:收件箱(40)其中数量闪烁就会起到警示效果。可以适用如下Storyboard实现:
<ItemsControl.ItemTemplate><DataTemplate> <Button Command="{x:Static local:QueryRecordItem.OpenCommand}" FocusVisualStyle="{x:Null}" Focusable="False" ContextMenu="{StaticResource ShellContextMenu}" ToolTip="{Binding ToolTip}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Description}"/> <TextBlock Text="{Binding TipText}" Foreground="Red" Visibility="{Binding Converter={x:Static jsm:Converters.BooleanToVisibility}, Path=HasItem, ConverterParameter=true}"/> <Border Background="Red" CornerRadius="5" Visibility="{Binding Converter={x:Static jsm:Converters.BooleanToVisibility}, Path=HasItem}"> <Border.Triggers> <EventTrigger RoutedEvent="Loaded"> <BeginStoryboard> <Storyboard BeginTime="0:0:0" AutoReverse="True" RepeatBehavior="Forever"> <ColorAnimation From="Red" To="Navy" RepeatBehavior="Forever" Storyboard.TargetProperty="Background.Color"> </ColorAnimation> </Storyboard> </BeginStoryboard> </EventTrigger> </Border.Triggers> <TextBlock Text="{Binding TipText}" Foreground="White"/> </Border> </StackPanel> </Button></DataTemplate></ItemsControl.ItemTemplate>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。