使用情节触发器时,如果有触发源/触发源控件时可以将情节触发器放置最顶级的面板控件的触发器中。
通过blend这个神器真的是可以学到不少东西。
代码:
//情节动画放置于顶级控制面板 <Widnow.Resources> <Storyboard x:Key="OnMouseLeftButtonUpForGrid"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="dockPanel"> <EasingDoubleKeyFrame KeyTime="0" Value="0.675"/> <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.896"/> <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0.997"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="dockPanel"> <EasingDoubleKeyFrame KeyTime="0" Value="0.638"/> <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.835"/> <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0.991"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="dockPanel"> <EasingDoubleKeyFrame KeyTime="0" Value="111"/> <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="35.25"/> <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="0.75"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="dockPanel"> <EasingDoubleKeyFrame KeyTime="0" Value="-66"/> <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="-30"/> <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-1.5"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Window.Triggers> <EventTrigger RoutedEvent="UIElement.MouseLeftButtonUp" SourceName="grid1"> <BeginStoryboard x:Name="OnMouseLeftButtonUpForGrid_BeginStoryboard" Storyboard="{StaticResource OnMouseLeftButtonUpForGrid}"/> </EventTrigger> </Window.Triggers>
<DockPanel x:Name="dockPanel" RenderTransformOrigin="0.5,0.5"> <DockPanel.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </DockPanel.RenderTransform> <Grid x:Name="grid1" Height="40" DockPanel.Dock="Top" Background="Red"> <Button x:Name="button" HorizontalAlignment="Right" Content="ccc"/> </Grid> <Grid x:Name="grid" Height="40" VerticalAlignment="Top" DockPanel.Dock="Top" Background="Green" RenderTransformOrigin="0.5,0.5"> </Grid> </DockPanel>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/12629.html