-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSpinnerControl.xaml
46 lines (43 loc) · 2.14 KB
/
SpinnerControl.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<UserControl x:Class="PhantomUI.SpinnerControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:phantomUi="clr-namespace:PhantomUI"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<Storyboard x:Key="Storyboard">
<DoubleAnimation Storyboard.TargetName="ellipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
From="0" To="360" Duration="00:00:01"
RepeatBehavior="Forever"/>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse">
<EasingColorKeyFrame KeyTime="0" Value="Black"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="phantomUi:SpinnerControl.StartAnimation">
<BeginStoryboard Storyboard="{StaticResource Storyboard}" Name="MyStoryBoard"/>
</EventTrigger>
<EventTrigger RoutedEvent="phantomUi:SpinnerControl.StopAnimation">
<StopStoryboard BeginStoryboardName="MyStoryBoard"></StopStoryboard>
</EventTrigger>
</UserControl.Triggers>
<Grid>
<Ellipse x:Name="ellipse" Fill="Black" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.OpacityMask>
<ImageBrush ImageSource="media/spinnermask.png"/>
</Ellipse.OpacityMask>
</Ellipse>
</Grid>
</UserControl>