|
| 1 | +<Page x:Class="TransitionHelperExperiment.Samples.TransitionHelperFullExample" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 5 | + xmlns:i="using:Microsoft.Xaml.Interactivity" |
| 6 | + xmlns:ic="using:Microsoft.Xaml.Interactions.Core" |
| 7 | + xmlns:labs="using:CommunityToolkit.Labs.WinUI" |
| 8 | + xmlns:local="using:TransitionHelperExperiment.Samples" |
| 9 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 10 | + mc:Ignorable="d"> |
| 11 | + |
| 12 | + <Page.Resources> |
| 13 | + <labs:TransitionHelper x:Key="MyTransitionHelper"> |
| 14 | + <labs:TransitionConfig Id="background" |
| 15 | + ScaleMode="Scale" /> |
| 16 | + <labs:TransitionConfig Id="image" |
| 17 | + ScaleMode="Scale" /> |
| 18 | + <labs:TransitionConfig Id="name" |
| 19 | + ScaleMode="Custom"> |
| 20 | + <labs:TransitionConfig.CustomScalingCalculator> |
| 21 | + <local:CustomTextScalingCalculator /> |
| 22 | + </labs:TransitionConfig.CustomScalingCalculator> |
| 23 | + </labs:TransitionConfig> |
| 24 | + <labs:TransitionConfig EnableClipAnimation="true" |
| 25 | + Id="desc" /> |
| 26 | + </labs:TransitionHelper> |
| 27 | + |
| 28 | + <ImageBrush x:Key="ImageBackgroundBrush" |
| 29 | + ImageSource="ms-appx:///Assets/Owl2.jpg" /> |
| 30 | + </Page.Resources> |
| 31 | + <Grid> |
| 32 | + <StackPanel x:Name="FirstControl" |
| 33 | + Margin="100,50" |
| 34 | + HorizontalAlignment="Left" |
| 35 | + VerticalAlignment="Top" |
| 36 | + Orientation="Horizontal" |
| 37 | + Spacing="10"> |
| 38 | + <Grid Width="50" |
| 39 | + Height="50"> |
| 40 | + <Border labs:TransitionHelper.Id="background" |
| 41 | + Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" |
| 42 | + CornerRadius="4" /> |
| 43 | + <Border Width="36" |
| 44 | + Height="36" |
| 45 | + labs:TransitionHelper.Id="image" |
| 46 | + Background="{StaticResource ImageBackgroundBrush}" |
| 47 | + CornerRadius="18" /> |
| 48 | + </Grid> |
| 49 | + <StackPanel labs:TransitionHelper.Id="guide" |
| 50 | + Spacing="2"> |
| 51 | + <Button x:Name="MinToMidButton" |
| 52 | + Content="" |
| 53 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 54 | + <i:Interaction.Behaviors> |
| 55 | + <ic:EventTriggerBehavior EventName="Click"> |
| 56 | + <labs:StartTransitionAction Source="{Binding ElementName=FirstControl}" |
| 57 | + Target="{Binding ElementName=SecondControl}" |
| 58 | + Transition="{StaticResource MyTransitionHelper}" /> |
| 59 | + </ic:EventTriggerBehavior> |
| 60 | + </i:Interaction.Behaviors> |
| 61 | + </Button> |
| 62 | + <Button x:Name="MinToMaxButton" |
| 63 | + Content="" |
| 64 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 65 | + <i:Interaction.Behaviors> |
| 66 | + <ic:EventTriggerBehavior EventName="Click"> |
| 67 | + <labs:StartTransitionAction Source="{Binding ElementName=FirstControl}" |
| 68 | + Target="{Binding ElementName=ThirdControl}" |
| 69 | + Transition="{StaticResource MyTransitionHelper}" /> |
| 70 | + </ic:EventTriggerBehavior> |
| 71 | + </i:Interaction.Behaviors> |
| 72 | + </Button> |
| 73 | + </StackPanel> |
| 74 | + </StackPanel> |
| 75 | + <Grid x:Name="SecondControl" |
| 76 | + Margin="0,100" |
| 77 | + HorizontalAlignment="Center" |
| 78 | + VerticalAlignment="Top" |
| 79 | + Visibility="Collapsed"> |
| 80 | + <Border labs:TransitionHelper.Id="background" |
| 81 | + Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" |
| 82 | + CornerRadius="8" /> |
| 83 | + <StackPanel Padding="20" |
| 84 | + Orientation="Horizontal" |
| 85 | + Spacing="20"> |
| 86 | + <Border Width="50" |
| 87 | + Height="50" |
| 88 | + labs:TransitionHelper.Id="image" |
| 89 | + Background="{StaticResource ImageBackgroundBrush}" |
| 90 | + CornerRadius="25" /> |
| 91 | + <StackPanel Width="400" |
| 92 | + VerticalAlignment="Center" |
| 93 | + Spacing="5"> |
| 94 | + <TextBlock labs:TransitionHelper.Id="name">Magic</TextBlock> |
| 95 | + <TextBlock labs:TransitionHelper.Id="desc">Magic is a cute 😺.</TextBlock> |
| 96 | + </StackPanel> |
| 97 | + <StackPanel labs:TransitionHelper.Id="guide" |
| 98 | + Orientation="Horizontal" |
| 99 | + Spacing="2"> |
| 100 | + <Button Content="" |
| 101 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 102 | + <i:Interaction.Behaviors> |
| 103 | + <ic:EventTriggerBehavior EventName="Click"> |
| 104 | + <labs:ReverseTransitionAction Transition="{StaticResource MyTransitionHelper}" /> |
| 105 | + </ic:EventTriggerBehavior> |
| 106 | + </i:Interaction.Behaviors> |
| 107 | + </Button> |
| 108 | + <Button x:Name="MidToMinButton" |
| 109 | + Content="" |
| 110 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 111 | + <i:Interaction.Behaviors> |
| 112 | + <ic:EventTriggerBehavior EventName="Click"> |
| 113 | + <labs:StartTransitionAction Source="{Binding ElementName=SecondControl}" |
| 114 | + Target="{Binding ElementName=FirstControl}" |
| 115 | + Transition="{StaticResource MyTransitionHelper}" /> |
| 116 | + </ic:EventTriggerBehavior> |
| 117 | + </i:Interaction.Behaviors> |
| 118 | + </Button> |
| 119 | + <Button x:Name="MidToMaxButton" |
| 120 | + Content="" |
| 121 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 122 | + <i:Interaction.Behaviors> |
| 123 | + <ic:EventTriggerBehavior EventName="Click"> |
| 124 | + <labs:StartTransitionAction Source="{Binding ElementName=SecondControl}" |
| 125 | + Target="{Binding ElementName=ThirdControl}" |
| 126 | + Transition="{StaticResource MyTransitionHelper}" /> |
| 127 | + </ic:EventTriggerBehavior> |
| 128 | + </i:Interaction.Behaviors> |
| 129 | + </Button> |
| 130 | + </StackPanel> |
| 131 | + </StackPanel> |
| 132 | + </Grid> |
| 133 | + <Grid x:Name="ThirdControl" |
| 134 | + HorizontalAlignment="Center" |
| 135 | + VerticalAlignment="Center" |
| 136 | + Visibility="Collapsed"> |
| 137 | + <Border labs:TransitionHelper.Id="background" |
| 138 | + Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" |
| 139 | + CornerRadius="8" /> |
| 140 | + <StackPanel Padding="20" |
| 141 | + HorizontalAlignment="Center" |
| 142 | + Spacing="20"> |
| 143 | + <Border Width="80" |
| 144 | + Height="80" |
| 145 | + labs:TransitionHelper.Id="image" |
| 146 | + Background="{StaticResource ImageBackgroundBrush}" |
| 147 | + CornerRadius="40" /> |
| 148 | + <StackPanel Spacing="5"> |
| 149 | + <TextBlock MaxWidth="200" |
| 150 | + HorizontalAlignment="Center" |
| 151 | + labs:TransitionHelper.Id="name" |
| 152 | + FontSize="24" |
| 153 | + TextAlignment="Center" |
| 154 | + TextWrapping="Wrap"> |
| 155 | + Magic is my cat's name |
| 156 | + </TextBlock> |
| 157 | + <TextBlock HorizontalAlignment="Center" |
| 158 | + labs:TransitionHelper.Id="desc"> |
| 159 | + Magic is a cute 😺, but sometimes very naughty. |
| 160 | + </TextBlock> |
| 161 | + </StackPanel> |
| 162 | + <StackPanel Padding="50,100" |
| 163 | + labs:TransitionHelper.IsIndependent="True"> |
| 164 | + <Rectangle Width="200" |
| 165 | + Height="20" |
| 166 | + Margin="10" |
| 167 | + HorizontalAlignment="Left" |
| 168 | + Fill="Silver" |
| 169 | + Opacity="0.6" |
| 170 | + RadiusX="5" |
| 171 | + RadiusY="5" /> |
| 172 | + <Rectangle Width="300" |
| 173 | + Height="20" |
| 174 | + Margin="10" |
| 175 | + HorizontalAlignment="Left" |
| 176 | + Fill="Silver" |
| 177 | + Opacity="0.6" |
| 178 | + RadiusX="5" |
| 179 | + RadiusY="5" /> |
| 180 | + <Rectangle Width="200" |
| 181 | + Height="20" |
| 182 | + Margin="10" |
| 183 | + HorizontalAlignment="Left" |
| 184 | + Fill="Silver" |
| 185 | + Opacity="0.6" |
| 186 | + RadiusX="5" |
| 187 | + RadiusY="5" /> |
| 188 | + <Rectangle Width="400" |
| 189 | + Height="20" |
| 190 | + Margin="10" |
| 191 | + HorizontalAlignment="Left" |
| 192 | + Fill="Silver" |
| 193 | + Opacity="0.6" |
| 194 | + RadiusX="5" |
| 195 | + RadiusY="5" /> |
| 196 | + </StackPanel> |
| 197 | + </StackPanel> |
| 198 | + <StackPanel Margin="10" |
| 199 | + HorizontalAlignment="Right" |
| 200 | + VerticalAlignment="Top" |
| 201 | + labs:TransitionHelper.Id="guide" |
| 202 | + Orientation="Horizontal" |
| 203 | + Spacing="2"> |
| 204 | + <Button Content="" |
| 205 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 206 | + <i:Interaction.Behaviors> |
| 207 | + <ic:EventTriggerBehavior EventName="Click"> |
| 208 | + <labs:ReverseTransitionAction Transition="{StaticResource MyTransitionHelper}" /> |
| 209 | + </ic:EventTriggerBehavior> |
| 210 | + </i:Interaction.Behaviors> |
| 211 | + </Button> |
| 212 | + <Button x:Name="MaxToMinButton" |
| 213 | + Content="" |
| 214 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 215 | + <i:Interaction.Behaviors> |
| 216 | + <ic:EventTriggerBehavior EventName="Click"> |
| 217 | + <labs:StartTransitionAction Source="{Binding ElementName=ThirdControl}" |
| 218 | + Target="{Binding ElementName=FirstControl}" |
| 219 | + Transition="{StaticResource MyTransitionHelper}" /> |
| 220 | + </ic:EventTriggerBehavior> |
| 221 | + </i:Interaction.Behaviors> |
| 222 | + </Button> |
| 223 | + <Button x:Name="MaxToMidButton" |
| 224 | + Content="" |
| 225 | + Style="{StaticResource NavigationBackButtonNormalStyle}"> |
| 226 | + <i:Interaction.Behaviors> |
| 227 | + <ic:EventTriggerBehavior EventName="Click"> |
| 228 | + <labs:StartTransitionAction Source="{Binding ElementName=ThirdControl}" |
| 229 | + Target="{Binding ElementName=SecondControl}" |
| 230 | + Transition="{StaticResource MyTransitionHelper}" /> |
| 231 | + </ic:EventTriggerBehavior> |
| 232 | + </i:Interaction.Behaviors> |
| 233 | + </Button> |
| 234 | + </StackPanel> |
| 235 | + </Grid> |
| 236 | + </Grid> |
| 237 | +</Page> |
0 commit comments