Sunday, June 10, 2007 9:27 PM
Geoff
Worst. Login. Dialog. Ever.
Playing around with XAML animations tonight. I should be placed against the wall for this, but I couldn't resist. Might start a new craze...
Open up XAMLPad and past this rubbish into it:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Page.Resources>
<Style TargetType="Border" x:Key="PageBackground">
<Setter Property="Background" Value="#eeeeff" />
</Style>
</Page.Resources>
<Grid Background="#aaaabb" Width="450" Height="120">
<Border Style="{StaticResource PageBackground}" Margin="1.5,1.5,1.5,1.5" Name="mainBorder">
<Border.Triggers>
<EventTrigger RoutedEvent="Border.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="mainBorder"
Storyboard.TargetProperty="Width"
From="400"
To="450"
Duration="0:0:0.25"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="mainBorder"
Storyboard.TargetProperty="Height"
From="100"
To="120"
Duration="0:0:0.25"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Border.Triggers>
<StackPanel Margin="5,5,5,5">
<StackPanel Orientation="Horizontal">
<Label Width="100">User ID:</Label>
<TextBox Width="200" Margin="5,5,5,5" Name="userIDTextBox">
<!--<TextBox.BitmapEffect>
<DropShadowBitmapEffect/>
</TextBox.BitmapEffect> -->
<TextBox.Triggers>
<EventTrigger RoutedEvent="TextBox.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="userIDTextBox"
Storyboard.TargetProperty="Opacity"
From="1.0"
To="0.0"
Duration="0:0:0.25"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBox.Triggers>
</TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Width="100">Password:</Label>
<TextBox Width="200" Margin="5,5,5,5">
<TextBox.BitmapEffect>
<BitmapEffectGroup>
<DropShadowBitmapEffect />
<BlurBitmapEffect Radius="1" />
</BitmapEffectGroup>
</TextBox.BitmapEffect>
</TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="100" Margin="5" Name="loginButton" >
Login
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="loginButton"
Storyboard.TargetProperty="Opacity"
From="0.75"
To="0.5"
Duration="0:0:0.5"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Button Width="100" Margin="5" >Exit</Button>
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Page>