Created
August 27, 2012 15:07
-
-
Save Nilzor/3489342 to your computer and use it in GitHub Desktop.
ForegroundAnimPage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Page | |
| x:Class="GTWin8.Ui.Drafts.ForegroundAnimPage" | |
| IsTabStop="false" | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| xmlns:local="using:GTWin8.Ui.Drafts" | |
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
| mc:Ignorable="d"> | |
| <Page.Resources> | |
| <Storyboard x:Name="TheAnimation"> | |
| <ObjectAnimationUsingKeyFrames | |
| Storyboard.TargetName="TheTextBox" | |
| Storyboard.TargetProperty="(Foreground).(SolidColorBrush.Color)"> | |
| <DiscreteObjectKeyFrame KeyTime="0" Value="#FF0000"/> | |
| </ObjectAnimationUsingKeyFrames> | |
| </Storyboard> | |
| </Page.Resources> | |
| <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> | |
| <TextBox x:Name="TheTextBox" HorizontalAlignment="Left" Margin="11,57,0,0" | |
| TextWrapping="Wrap" | |
| Text="Some text" VerticalAlignment="Top" | |
| BorderBrush="White" | |
| Background="#FFBBBB" IsReadOnly="True"/> | |
| <Button x:Name="TheButton" Content="Animate" Click="Button_Click_1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/> | |
| </Grid> | |
| </Page> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.IO; | |
| using System.Linq; | |
| using Windows.Foundation; | |
| using Windows.Foundation.Collections; | |
| using Windows.UI.Xaml; | |
| using Windows.UI.Xaml.Controls; | |
| using Windows.UI.Xaml.Controls.Primitives; | |
| using Windows.UI.Xaml.Data; | |
| using Windows.UI.Xaml.Input; | |
| using Windows.UI.Xaml.Media; | |
| using Windows.UI.Xaml.Media.Animation; | |
| using Windows.UI.Xaml.Navigation; | |
| // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 | |
| namespace GTWin8.Ui.Drafts | |
| { | |
| /// <summary> | |
| /// An empty page that can be used on its own or navigated to within a Frame. | |
| /// </summary> | |
| public sealed partial class ForegroundAnimPage : Page | |
| { | |
| public ForegroundAnimPage() | |
| { | |
| this.InitializeComponent(); | |
| TheAnimation.Completed += TheAnimation_Completed; | |
| } | |
| /// <summary> | |
| /// Invoked when this page is about to be displayed in a Frame. | |
| /// </summary> | |
| /// <param name="e">Event data that describes how this page was reached. The Parameter | |
| /// property is typically used to configure the page.</param> | |
| protected override void OnNavigatedTo(NavigationEventArgs e) | |
| { | |
| } | |
| private void Button_Click_1(object sender, RoutedEventArgs e) | |
| { | |
| Debug.WriteLine("Color before animation: " + ((SolidColorBrush)TheTextBox.Foreground).Color); | |
| TheAnimation.Begin(); | |
| } | |
| void TheAnimation_Completed(object sender, object e) | |
| { | |
| Debug.WriteLine(" Color after animation: " + ((SolidColorBrush)TheTextBox.Foreground).Color); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment