|
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
6 | 6 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
7 | 7 | xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
|
| 8 | + xmlns:interactivity="using:Microsoft.Xaml.Interactivity" |
| 9 | + xmlns:interactions="using:Microsoft.Xaml.Interactions.Core" |
| 10 | + xmlns:ani="using:Microsoft.Toolkit.Uwp.UI.Animations" |
| 11 | + xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors" |
8 | 12 | mc:Ignorable="d">
|
9 | 13 |
|
10 |
| - <Grid> |
| 14 | + <StackPanel Spacing="120" VerticalAlignment="Center"> |
| 15 | + |
| 16 | + <!--This is a static element, with some Visual properties being modified through |
| 17 | + the VisualExtensions class. You can modify their values to see how the position, |
| 18 | + orientation and alignment of the Border element changes.--> |
11 | 19 | <Border Height="100"
|
12 | 20 | Width="100"
|
13 | 21 | Background="Purple"
|
| 22 | + ui:VisualExtensions.CenterPoint="50,50,0" |
| 23 | + ui:VisualExtensions.Offset="50" |
14 | 24 | ui:VisualExtensions.Opacity="0.5"
|
15 | 25 | ui:VisualExtensions.RotationAngleInDegrees="80"
|
16 | 26 | ui:VisualExtensions.Scale="2, 0.5, 1"
|
17 |
| - ui:VisualExtensions.NormalizedCenterPoint="0.5" /> |
18 |
| - </Grid> |
| 27 | + ui:VisualExtensions.NormalizedCenterPoint="0.5" |
| 28 | + ui:VisualExtensions.Translation="20,12,0"/> |
| 29 | + |
| 30 | + <!--This Button demonstrates the VisualExtensions.Translation property in combination with a translation |
| 31 | + animation. The Translation property is set to indicate the starting position of the element (relative |
| 32 | + to its offset), and the animation will modify that to reach the specified translation value. Note how |
| 33 | + the animation doesn't have an explicit starting value, as it will just start animating the translation |
| 34 | + from the current value set via the VisualExtensions.Translation attached property.--> |
| 35 | + <Button Height="120" |
| 36 | + Width="360" |
| 37 | + Background="Green" |
| 38 | + Content="Click me!" |
| 39 | + FontSize="32" |
| 40 | + ui:VisualExtensions.Translation="20,-40,0"> |
| 41 | + <ani:Explicit.Animations> |
| 42 | + <ani:AnimationSet x:Name="MoveAnimation"> |
| 43 | + <ani:TranslationAnimation To="480,80,0" Duration="0:0:2"/> |
| 44 | + </ani:AnimationSet> |
| 45 | + </ani:Explicit.Animations> |
| 46 | + <interactivity:Interaction.Behaviors> |
| 47 | + <interactions:EventTriggerBehavior EventName="Click"> |
| 48 | + <behaviors:StartAnimationAction Animation="{Binding ElementName=MoveAnimation}"/> |
| 49 | + </interactions:EventTriggerBehavior> |
| 50 | + </interactivity:Interaction.Behaviors> |
| 51 | + </Button> |
| 52 | + </StackPanel> |
19 | 53 | </Page>
|
0 commit comments