-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathInvokeActionsActivitySample.xaml
More file actions
63 lines (60 loc) · 3.37 KB
/
InvokeActionsActivitySample.xaml
File metadata and controls
63 lines (60 loc) · 3.37 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Page x:Class="BehaviorsExperiment.Samples.InvokeActionsActivitySample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ani="using:CommunityToolkit.WinUI.Animations"
xmlns:behaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:BehaviorsExperiment.Samples"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Button Width="140"
Height="140"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<ani:Explicit.Animations>
<ani:AnimationSet x:Name="MoveAnimation"
IsSequential="True">
<ani:StartAnimationActivity Animation="{Binding ElementName=FadeOutAnimation}" />
<ani:InvokeActionsActivity>
<interactivity:ChangePropertyAction PropertyName="Foreground"
TargetObject="{Binding ElementName=MyText}"
Value="Purple" />
<!--<mediaactions:PlaySoundAction Source="Assets/Llama.mp3"/>-->
</ani:InvokeActionsActivity>
<ani:StartAnimationActivity Animation="{Binding ElementName=FadeInAnimation}"
Delay="0:0:2" />
</ani:AnimationSet>
</ani:Explicit.Animations>
<TextBlock x:Name="MyText"
Text="🦙 Text">
<ani:Explicit.Animations>
<ani:AnimationSet x:Name="FadeOutAnimation">
<ani:OpacityAnimation Delay="0"
EasingMode="EaseOut"
EasingType="Linear"
From="1"
To="0"
Duration="0:0:1" />
</ani:AnimationSet>
<ani:AnimationSet x:Name="FadeInAnimation">
<ani:OpacityAnimation Delay="0"
EasingMode="EaseOut"
EasingType="Linear"
From="0"
To="1"
Duration="0:0:1" />
</ani:AnimationSet>
</ani:Explicit.Animations>
</TextBlock>
<interactivity:Interaction.Behaviors>
<interactivity:EventTriggerBehavior EventName="Click">
<interactivity:ChangePropertyAction PropertyName="Foreground"
TargetObject="{Binding ElementName=MyText}"
Value="White" />
<behaviors:StartAnimationAction Animation="{Binding ElementName=MoveAnimation}" />
</interactivity:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</Button>
</Page>