首页 > 代码库 > WPF里的报警闪烁效果

WPF里的报警闪烁效果

<esri:MarkerSymbol x:Key="FlashMarkerSymbol" OffsetX="41" OffsetY="41">
<esri:MarkerSymbol.ControlTemplate>
<ControlTemplate>
<Grid Height="81" Width="81">
<Grid.Resources>
<Style TargetType="{x:Type Line}">
<Setter Property="Cursor" Value="http://www.mamicode.com/Hand"/>
<Setter Property="Stroke" Value="http://www.mamicode.com/Red"/>
<Setter Property="StrokeThickness" Value="http://www.mamicode.com/1"/>
</Style>
</Grid.Resources>
<Ellipse x:Name="elp1">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#F00" Offset="1"/>
<GradientStop Color="#0FB2" Offset="0"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Fill="White" Height="11" Stroke="#000" StrokeThickness="1" StrokeDashArray="5,2.95" StrokeDashOffset="6.7" Width="11"/>
<Line X1="31" Y1="40.5" X2="38" Y2="40.5"/>
<Line X1="43" Y1="40.5" X2="50" Y2="40.5"/>
<Line X1="40.5" Y1="31" X2="40.5" Y2="38"/>
<Line X1="40.5" Y1="43" X2="40.5" Y2="50"/>
<Ellipse x:Name="elp2" Cursor="Hand" Height="9" Width="9">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#F00" Offset="1"/>
<GradientStop Color="#FD9" Offset="0"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Grid>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="elp2">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="elp1" Storyboard.TargetProperty="Width" From="10" To="80" Duration="0:0:1.5"/>
<DoubleAnimation Storyboard.TargetName="elp1" Storyboard.TargetProperty="Height" From="10" To="80" Duration="0:0:1.5"/>
<DoubleAnimation Storyboard.TargetName="elp1" Storyboard.TargetProperty="Opacity" From="0.9" To="0" Duration="0:0:1.5"/>
<DoubleAnimation Storyboard.TargetName="elp2" Storyboard.TargetProperty="Opacity" From="0.3" To="1" Duration="0:0:1.5"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>

</esri:MarkerSymbol.ControlTemplate>
</esri:MarkerSymbol>

WPF里的报警闪烁效果