|
This example continues from a previous example [Design Tip 347], and based on my Flash version [Flash Version]. The .NET 3 examples on this page are at:
Try: [Example 15] for the DotNet3 run from a Web browser.
A Simple Test Example
1 . In this a test is created, with animation for the test elements.

afterwhich the XAML is integrated in Visual Studio (for a Web page): <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="dotnet3_15.Page1" x:Name="Page" Title="Page1" Width="727" Height="480">
<Page.Resources>
<Storyboard x:Key="Timeline1">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q1" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="349"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-18"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-18"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-18"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-18"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy5" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-305"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy16" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-305"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy17" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-305"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-305"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy5" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy16" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy17" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q2" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="89"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-306"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-16"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy5" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-306"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy5" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-16"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy6" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-306"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy6" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-16"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-306"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="q4" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:04" Value="-16"/>
</DoubleAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy17" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF2F4F3"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy16" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE9F0EC"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy5" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFAFEFC"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy6" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFAFCFB"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy3" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF2F6F4"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy5" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF8FCFA"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF6F8F7"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF6F6F6"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy3" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF2FAF6"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF0F6F3"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Path_Copy4" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF8FAF9"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Rectangle_Copy1" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFF0F8F4"/>
<SplineColorKeyFrame KeyTime="00:00:04" Value="#FF006432"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</Page.Resources>
<Page.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource Timeline1}"/>
</EventTrigger>
</Page.Triggers>
<Grid x:Name="LayoutRoot">
<Rectangle x:Name="Rectangle_Copy3" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,0,-189.167,19" VerticalAlignment="Bottom" Width="212.037" Height="44.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<Path x:Name="Path_Copy5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 350.124,237.771L 293.732,273.667L 297.204,199.028L 350.124,237.771 Z " Width="57.392" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,0,-242.624,19" VerticalAlignment="Bottom" Height="44.278">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="Path_Copy6" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 32.2809,233.128L 88.6684,197.335L 85.2053,271.766L 32.2809,233.128 Z " Width="57.387" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,0,18.87,19" VerticalAlignment="Bottom" Height="44.5">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<TextBox x:Name="q4" Background="{x:Null}" BorderBrush="{x:Null}" Text="TextBox" TextWrapping="Wrap" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,0,-185.232,9.806" VerticalAlignment="Bottom" Width="196.064" Height="53.472" Foreground="White">
<TextBox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<Rectangle x:Name="Rectangle_Copy5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" OpacityMask="#FF000000" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,202.5,-189.167,197" Width="212.037" Height="44.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<Path x:Name="Path_Copy16" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 350.124,237.771L 293.732,273.667L 297.204,199.028L 350.124,237.771 Z " Width="57.392" OpacityMask="#FF000000" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,202.722,-242.624,197" Height="44.5">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="Path_Copy17" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 32.2809,233.128L 88.6684,197.335L 85.2053,271.766L 32.2809,233.128 Z " Width="57.387" OpacityMask="#FF000000" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,202.5,18.87,197" Height="44.5">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<TextBox x:Name="q2" Background="{x:Null}" BorderBrush="{x:Null}" Text="TextBox" TextWrapping="Wrap" OpacityMask="#FF000000" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right" Margin="0,223,-185,168" Width="196.064" Foreground="White">
<TextBox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<Rectangle x:Name="Rectangle_Copy2" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-291.87,0,0,19" VerticalAlignment="Bottom" Width="212.037" Height="44.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<Path x:Name="Path_Copy3" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 350.124,237.771L 293.732,273.667L 297.204,199.028L 350.124,237.771 Z " Width="57.392" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-83.768,0,0,19" VerticalAlignment="Bottom" Height="44.278">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="Path_Copy4" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 32.2809,233.128L 88.6684,197.335L 85.2053,271.766L 32.2809,233.128 Z " Width="57.387" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-345.257,0,0,19" VerticalAlignment="Bottom" Height="44.5">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<TextBox x:Name="q3" Background="{x:Null}" BorderBrush="{x:Null}" Text="TextBox" TextWrapping="Wrap" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-279.832,0,0,9.806" VerticalAlignment="Bottom" Width="196.064" Height="53.472" Foreground="White">
<TextBox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<Rectangle x:Name="Rectangle_Copy1" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-291.87,202.5,0,197" Width="212.037" Height="44.5">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<Path x:Name="Path_Copy1" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 350.124,237.771L 293.732,273.667L 297.204,199.028L 350.124,237.771 Z " Width="57.392" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-83.768,202.722,0,197" Height="44.5">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Path x:Name="Path_Copy2" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF006432" Fill="#FF006432" Data="F1 M 32.2809,233.128L 88.6684,197.335L 85.2053,271.766L 32.2809,233.128 Z " Width="57.387" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-345.257,202.5,0,197" Height="44.5">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<TextBox x:Name="q1" Background="{x:Null}" BorderBrush="{x:Null}" Text="TextBox" TextWrapping="Wrap" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="-279.832,225.782,0,164.335" Width="196.064" Foreground="White">
<TextBox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<Button Height="44.299" HorizontalAlignment="Left" Margin="41.441,21.435,0,0" Name="button1" VerticalAlignment="Top" Width="111.462" Click="button1_Click_1">Reload</Button>
<Frame Name="frame"/>
<Label Height="28" Margin="61.447,111.462,82.882,0" Name="label1" VerticalAlignment="Top"></Label>
</Grid>
</Page>
The CS code is then added as:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace dotnet3_15
{
/// <summary>
/// Interaction logic for Page1.xaml
/// </summary>
public partial class Page1 : Page
{
string[] question = { "What is the capital of Scotland",
"What is the capital of England",
"What is the capital of Wales"};
string[] quest1 = { "Glasgow", "London","Cardiff" };
string[] quest2 = { "Edinburgh", "Manchester","Swansea" };
string[] quest3 = { "Stirling", "York","Bridgend" };
string[] quest4 = { "Falkirk", "Leeds" ,"Wrexham"};
Random r = new Random();
public Page1()
{
InitializeComponent();
genContent();
}
public void genContent()
{
int select = r.Next(2);
this.textBox1.Text= question[select];
this.q1.Text = quest1[select];
this.q2.Text = quest2[select];
this.q3.Text = quest3[select];
this.q4.Text = quest4[select];
}
private void button1_Click_1(object sender, RoutedEventArgs e)
{
this.Path_Copy1.Opacity = 0; this.Path_Copy16.Opacity = 0;
this.Path_Copy2.Opacity = 0; this.Path_Copy3.Opacity = 0;
this.Path_Copy4.Opacity = 0; this.Path_Copy5.Opacity = 0;
this.Path_Copy6.Opacity = 0; this.Path_Copy17.Opacity = 0;
this.Rectangle_Copy1.Opacity = 0;
this.Rectangle_Copy2.Opacity = 0;
this.Rectangle_Copy3.Opacity = 0;
this.Rectangle_Copy5.Opacity = 0;
frame.Navigate(new Uri("Page1.xaml", UriKind.Relative));
genContent();
}
}
}
I found if I add a Frame tag to the XAML, I can reload the page.
|