1 <Grid Grid.Column="0"> 2 <Grid.RowDefinitions> 3 <RowDefinition Height="0.4*" /> 4 <RowDefinition Height="0.6*" /> 5 </Grid.RowDefinitions> 6 <Grid.Resources> 7 <ResourceDictionary> 8 <ResourceDictionary.MergedDictionaries> 9 </ResourceDictionary.MergedDictionaries> 10 <DrawingBrush x:Key="MyWireBrushResource" Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile"> 11 <DrawingBrush.Drawing> 12 <DrawingGroup> 13 <DrawingGroup.Children> 14 <GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z" Brush="#66CCCCFF" /> 15 <GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="#66CCCCFF" /> 16 </DrawingGroup.Children> 17 </DrawingGroup> 18 </DrawingBrush.Drawing> 19 </DrawingBrush> 20 </ResourceDictionary> 21 </Grid.Resources> 22 <Grid.Background> 23 <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> 24 <LinearGradientBrush.GradientStops> 25 <GradientStop Offset="0.0" Color="Black" /> 26 <GradientStop Offset="1.0" Color="#666666" /> 27 </LinearGradientBrush.GradientStops> 28 </LinearGradientBrush> 29 </Grid.Background> 30 <StackPanel x:Name="gdLogo" Grid.Row="0" > 31 <Border Name="TextBorder" HorizontalAlignment="Left" VerticalAlignment="Top" Background="{StaticResource MyWireBrushResource}"> 32 <TextBlock Name="RealText" FontFamily="Segoe UI" FontSize="30 px" Margin="10,30" Foreground="White"> 33 文字动画、倒影 34 <TextBlock.TextEffects> 35 <!-- The TextEffect to animate. --> 36 <TextEffect PositionCount="1" x:Name="MyTextEffect"> 37 <TextEffect.Transform> 38 <TranslateTransform x:Name="TextEffectTranslateTransform"/> 39 </TextEffect.Transform> 40 </TextEffect> 41 </TextBlock.TextEffects> <TextBlock.Triggers> 42 <EventTrigger RoutedEvent="TextBlock.Loaded"> 43 <BeginStoryboard> 44 <Storyboard> 45 <!-- Animates the Y factor of the 46 TextEffect's TranslateTransform. --> 47 <DoubleAnimation 48 Storyboard.TargetName="TextEffectTranslateTransform" 49 Storyboard.TargetProperty="Y" 50 From="0" 51 To="20" 52 Duration="00:00:0.25" 53 RepeatBehavior="Forever" 54 AutoReverse="True" /> 55 <!-- Animates the position of the TextEffect. --> 56 <Int32AnimationUsingKeyFrames 57 Storyboard.TargetName="MyTextEffect" 58 Storyboard.TargetProperty="PositionStart" 59 Duration="0:0:6.5" 60 AutoReverse="True" 61 RepeatBehavior="Forever"> 62 <Int32AnimationUsingKeyFrames.KeyFrames> 63 <DiscreteInt32KeyFrame Value="0" KeyTime="0:0:0" /> 64 <DiscreteInt32KeyFrame Value="1" KeyTime="0:0:0.5" /> 65 <DiscreteInt32KeyFrame Value="2" KeyTime="0:0:1" /> 66 <DiscreteInt32KeyFrame Value="3" KeyTime="0:0:1.5" /> 67 <DiscreteInt32KeyFrame Value="4" KeyTime="0:0:2" /> 68 <DiscreteInt32KeyFrame Value="5" KeyTime="0:0:2.5" /> 69 <DiscreteInt32KeyFrame Value="6" KeyTime="0:0:3" /> 70 <DiscreteInt32KeyFrame Value="7" KeyTime="0:0:3.5" /> 71 <DiscreteInt32KeyFrame Value="8" KeyTime="0:0:4" /> 72 <DiscreteInt32KeyFrame Value="9" KeyTime="0:0:4.5" /> 73 <DiscreteInt32KeyFrame Value="10" KeyTime="0:0:5" /> 74 <DiscreteInt32KeyFrame Value="11" KeyTime="0:0:5.5" /> 75 <DiscreteInt32KeyFrame Value="12" KeyTime="0:0:6" /> 76 </Int32AnimationUsingKeyFrames.KeyFrames> 77 </Int32AnimationUsingKeyFrames> 78 </Storyboard> 79 </BeginStoryboard> 80 </EventTrigger> 81 </TextBlock.Triggers> 82 </TextBlock> 83 </Border> 84 <!-- Uses a VisualBrush to create a reflection of the animated text. --> 85 <Rectangle Name="ReflectedText" 86 Height="{Binding ElementName=TextBorder, Path=ActualHeight}" 87 Width="{Binding ElementName=TextBorder, Path=ActualWidth}" 88 HorizontalAlignment="Left"> 89 <Rectangle.OpacityMask> 90 <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> 91 <LinearGradientBrush.GradientStops> 92 <GradientStop Offset="0.0" Color="#66000000" /> 93 <GradientStop Offset="1.0" Color="#00000000" /> 94 </LinearGradientBrush.GradientStops> 95 </LinearGradientBrush> 96 </Rectangle.OpacityMask> 97 <Rectangle.Fill> 98 <VisualBrush Visual="{Binding ElementName=TextBorder}"> 99 <VisualBrush.RelativeTransform> 100 <TransformGroup> 101 <ScaleTransform ScaleX="1" ScaleY="-1" /> 102 <TranslateTransform Y="1" /> 103 </TransformGroup> 104 </VisualBrush.RelativeTransform> 105 </VisualBrush> 106 </Rectangle.Fill> 107 </Rectangle> 108 </StackPanel> 109 110 </Grid>