Answered by:
Blend 2012 for windows 8

Question
-
Hi Support Team I'm using Blend for Windows 8 2012 in Visual Basic I created animations I like to use but I wants my animation to play when the page is load without out using a button to the click event.
Thanks,
Denise
Sunday, June 8, 2014 8:44 PM
Answers
-
Hi Denise,
May I know where you put the code? Or could you simply give me a demo for a better understanding. Basically Blend is a tool that can help generate project code, so look into the code directly might be more helpful.
If you want to play the animation automatically when the page is loaded, you should put the code in the event: Page_Loaded, I create one and works fine(I use C# as the sample and should not be the problem with language syntax):
XAML:
<Page x:Class="App94.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App94" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Loaded="Page_Loaded"> <Page.Resources> <Storyboard x:Name="myStoryboard"> <DoubleAnimation From="1" To="6" Duration="00:00:6" Storyboard.TargetName="rectScaleTransform" Storyboard.TargetProperty="ScaleY"> <DoubleAnimation.EasingFunction> <BounceEase Bounces="2" EasingMode="EaseOut" Bounciness="2" /> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> </Page.Resources> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel> <Rectangle Fill="Blue" Width="200" Height="30"> <Rectangle.RenderTransform> <ScaleTransform x:Name="rectScaleTransform" /> </Rectangle.RenderTransform> </Rectangle> </StackPanel> </Grid> </Page>
CS:
private void Page_Loaded(object sender, RoutedEventArgs e) { myStoryboard.Begin(); }
Hope this helps.--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
- Edited by Jamles HezModerator Monday, June 9, 2014 5:54 AM
- Marked as answer by how do run a program Monday, June 9, 2014 4:01 PM
Monday, June 9, 2014 5:50 AMModerator -
Thanks Jamles that worked
Denise
- Marked as answer by how do run a program Monday, June 9, 2014 4:03 PM
Monday, June 9, 2014 3:59 PM
All replies
-
Hi Denise,
May I know where you put the code? Or could you simply give me a demo for a better understanding. Basically Blend is a tool that can help generate project code, so look into the code directly might be more helpful.
If you want to play the animation automatically when the page is loaded, you should put the code in the event: Page_Loaded, I create one and works fine(I use C# as the sample and should not be the problem with language syntax):
XAML:
<Page x:Class="App94.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App94" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Loaded="Page_Loaded"> <Page.Resources> <Storyboard x:Name="myStoryboard"> <DoubleAnimation From="1" To="6" Duration="00:00:6" Storyboard.TargetName="rectScaleTransform" Storyboard.TargetProperty="ScaleY"> <DoubleAnimation.EasingFunction> <BounceEase Bounces="2" EasingMode="EaseOut" Bounciness="2" /> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> </Page.Resources> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <StackPanel> <Rectangle Fill="Blue" Width="200" Height="30"> <Rectangle.RenderTransform> <ScaleTransform x:Name="rectScaleTransform" /> </Rectangle.RenderTransform> </Rectangle> </StackPanel> </Grid> </Page>
CS:
private void Page_Loaded(object sender, RoutedEventArgs e) { myStoryboard.Begin(); }
Hope this helps.--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
- Edited by Jamles HezModerator Monday, June 9, 2014 5:54 AM
- Marked as answer by how do run a program Monday, June 9, 2014 4:01 PM
Monday, June 9, 2014 5:50 AMModerator -
Thanks Jamles that worked
Denise
- Marked as answer by how do run a program Monday, June 9, 2014 4:03 PM
Monday, June 9, 2014 3:59 PM