Skip to content

Instantly share code, notes, and snippets.

@freeqaz
Created September 12, 2013 17:50
Show Gist options
  • Save freeqaz/6541325 to your computer and use it in GitHub Desktop.
Save freeqaz/6541325 to your computer and use it in GitHub Desktop.
Code pulled from a baked png
<Validation.ErrorTemplate>
<ControlTemplate>
<DockPanel x:Name="root" Opacity="0">
<Grid x:Name="errorMessage" DockPanel.Dock="Bottom" Opacity="0" RenderTransformOrigin="0, 0">
<Grid.RenderTransform>
<TranslateTransform x:Name="xform" X="0" />
</Grid.RenderTransform>
<Border Background="Red" CornerRadius="0" HorizontalAlignment="Stretch" />
<Border CornerRadius="0">
<TextBlock Foreground="{DynamicResource WhiteColorBrush}" Margin="8, 4, 8, 4" TextWrapping="Wrap" Text="{Binding ErrorContent}" UseLayoutRounding="False" />
</Border>
</Grid>
</DockPanel>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="root">
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<DataTrigger Binding="{Binding AdornedElement.IsFocused, ElementName=adnornedLayer}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
<SplineDoubleKeyFrame KeyTime="0:0:0.0" Value="25.0" />
<SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="errorMessage">
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
<SplineDoubleKeyFrame KeyTime="0:0:0.0" Value="0" />
<SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="25" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="errorMessage">
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Validation.ErrorTemplate>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment