Skip to content

Instantly share code, notes, and snippets.

@mbmccormick
Created March 6, 2012 02:44
Show Gist options
  • Save mbmccormick/1983036 to your computer and use it in GitHub Desktop.
Save mbmccormick/1983036 to your computer and use it in GitHub Desktop.
Add Task dialog used in Milkman
<UserControl x:Class="Milkman.AddTaskDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="Black"
d:DesignHeight="800" d:DesignWidth="480"
Loaded="UserControl_Loaded"
toolkit:TiltEffect.IsTiltEnabled="True"
Visibility="Collapsed"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid x:Name="grdMain" Width="480" Height="Auto" Background="#DEDEDE" VerticalAlignment="Top" Canvas.ZIndex="100">
<Grid.Projection>
<PlaneProjection/>
</Grid.Projection>
<Grid.RenderTransform>
<CompositeTransform/>
</Grid.RenderTransform>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Margin="18,0,18,12" Text="Add Task" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="{StaticResource PhoneFontSizeLarge}" FontWeight="Medium" />
<Canvas Margin="18,24" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Background="White" Canvas.ZIndex="1"/>
<TextBox x:Name="txtDetails" InputScope="Text" Margin="6,12" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" KeyUp="txtDetails_KeyUp" Canvas.ZIndex="2" Background="White" BorderBrush="Black" />
<toolkit:WrapPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="18,-12,18,0">
<TextBlock Text="^" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="6,0,18,0" Tap="Shortcut_Tap" />
<TextBlock Text="!" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="6,0,18,0" Tap="Shortcut_Tap" />
<TextBlock Text="#" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="6,0,18,0" Tap="Shortcut_Tap" />
<TextBlock Text="@" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="6,0,18,0" Tap="Shortcut_Tap" />
<TextBlock Text="*" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="6,0,18,0" Tap="Shortcut_Tap" />
<TextBlock Text="=" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="6,0,18,0" Tap="Shortcut_Tap" />
</toolkit:WrapPanel>
<Button x:Name="btnAdd" Margin="6,6,0,6" Content="add" Grid.Row="3" Grid.Column="0" Foreground="Black" Click="btnAdd_Click" />
<Button x:Name="btnCancel" Margin="0,6,6,6" Content="cancel" Grid.Row="3" Grid.Column="1" Foreground="Black" Click="btnCancel_Click" />
</Grid>
<Canvas Name="Overlay" MouseLeftButtonDown="Overlay_MouseLeftButtonDown">
<Canvas.Background>
<SolidColorBrush Color="{StaticResource PhoneSemitransparentColor}" />
</Canvas.Background>
</Canvas>
</Grid>
<UserControl.Resources>
<Storyboard x:Name="stbSwivelIn">
<DoubleAnimation BeginTime="0:0:0" Duration="0"
Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationY)"
Storyboard.TargetName="grdMain"
To=".5"/>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="grdMain">
<EasingDoubleKeyFrame KeyTime="0" Value="-90"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.35" Value="0">
<EasingDoubleKeyFrame.EasingFunction>
<ExponentialEase EasingMode="EaseOut" Exponent="6"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="grdMain">
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="stbSwivelOut">
<DoubleAnimation BeginTime="0:0:0" Duration="0"
Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.CenterOfRotationY)"
Storyboard.TargetName="grdMain"
To=".5"/>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="grdMain">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="45">
<EasingDoubleKeyFrame.EasingFunction>
<ExponentialEase EasingMode="EaseIn" Exponent="6"/>
</EasingDoubleKeyFrame.EasingFunction>
</EasingDoubleKeyFrame>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="grdMain">
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
<DiscreteDoubleKeyFrame KeyTime="0:0:0.267" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
</UserControl>
@martellaj
Copy link

Okay, I see the Storyboard tag. I wasn't sure how to use that in the XAML. I'll update our Log In dialog later today. Thanks for the code!

@mbmccormick
Copy link
Author

There's more to it in the codebehind, go look in my repository for that... AddTaskDialog.xaml.cs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment