WPF简单动画
来源:互联网 发布:淘宝粉丝福利购可靠吗 编辑:程序博客网 时间:2024/06/09 22:58
CSDN上有人问,怎么用WPF实现一个包含Image控件的Grid容器,在鼠标移入Image控件的时候,改变Grid的高度,而当鼠标移出Image的时候,Grid的高度恢复。
例子代码如下:
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Grid Height="200" HorizontalAlignment="Left" Margin="79,60,0,0" Background="Green" x:Name="grid1" VerticalAlignment="Top" Width="400"> <Image Height="150" HorizontalAlignment="Left" Margin="83,16,0,0" x:Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="200" Source="/WpfApplication1;component/Images/azsy.png"> <Image.Triggers> <EventTrigger RoutedEvent="MouseEnter"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="grid1" Storyboard.TargetProperty="Height" From="200" To="250" Duration="0:0:5"></DoubleAnimation> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> <EventTrigger RoutedEvent="MouseLeave"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="grid1" Storyboard.TargetProperty="Height" From="250" To="200" Duration="0:0:5"></DoubleAnimation> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </Image.Triggers> </Image> </Grid> </Grid></Window>
- WPF简单动画
- WPF动画简单练习
- WPF 简单动画
- WPF 简单的动画
- WPF入门(五)-WPF简单动画实现
- Wpf(Storyboard)动画简单实例
- 一个简单的WPF图片动画制作
- Wpf一个简单的物体移动动画
- WPF的简单关闭动画特效
- WPF动画
- WPF动画
- [WPF]动画
- WPF动画
- [WPF] 简单画刷动画及Content的概念
- WPF Animation - 如何创建一个简单的动画
- WPF动画[转]
- WPF中的动画
- 扩展 WPF 动画类
- c#操作文本文件
- httpd相关操作
- android:windowSoftInputMode属性使用
- 谈谈提前转正
- 6410-linux嵌入式平台搭建
- WPF简单动画
- 华为--C++ 笔试+面试题目
- Myeclipse 安装freemarker IDE插件
- .NET GZip压缩和解压缩文件
- Java实现二维码QRCode的编码和解码
- 碎语
- 正确解释CPU频率、外频、前端总线频率、内存频率
- javax.xml.parsers.FactoryConfigurationError错误分析
- 快逸报表中连续日期或月份问题的解决