WPF动画——故事板(Storyboard)
1、XAML代码
<Window x:Class="故事板.MainWindow" x:Name="window"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:故事板"
Title="MainWindow" Height="" Width="" >
<Window.Resources>
<hc:BtnHeightConverter x:Key="convert"></hc:BtnHeightConverter>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="dog" Storyboard.TargetProperty="Height"
From="" To="{Binding ElementName=window,Path=Height,Converter={StaticResource convert}}" Duration="0:0:1"
></DoubleAnimation>
<DoubleAnimation Storyboard.TargetName="dog" Storyboard.TargetProperty="Width"
From="" To="{Binding ElementName=window,Path=Width,Converter={StaticResource convert}}" Duration="0:0:2"
></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Grid>
<Button x:Name="dog" Width="" Height="" >
dog
</Button>
</Grid>
</Window>
2、后台代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; namespace 故事板
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
public class BtnHeightConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double width = ;
width = (double)value - ;
return width;
} public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
} }
3、效果



WPF动画——故事板(Storyboard)的更多相关文章
- 故事板(Storyboard)
1 使用Storyboard完成各项常见功能 1.1 问题 故事板Storyboard是IOS5开始引入的一个新的系统,将多个视图文件(类似xib文件)集中到一个单独的可视化工作区间,负责创建和管理所 ...
- Swift - 故事板storyboard的用法
故事板(UIStoryboard)可以很方便的进行界面的设计,下面总结了常用的几个操作方法: 1,初始场景 选中View Controller,在属性面板里勾选Is Initial View Cont ...
- 故事板(Storyboard) 、 iPad编程 、 App和VC的生命周期
1 创建动态TableView 1.1 问题 动态表视图就是显示多少分区,多少行以及每一行的显示内容都是根据数据源来决定.之前我们学过用xib展示动态表视图,本案例将学习如何使用Storyboard展 ...
- 【WPF学习】第五十章 故事板
正如上一章介绍,WPF动画通过一组动画类(Animation类)表示.使用少数几个熟悉设置相关信息,如开始值.结束值以及持续时间.这显然使得它们非常适合于XAML.不是很清晰的时:如何为特定的事件和属 ...
- 【WPF学习】第五十七章 使用代码创建故事板
在“[WPF学习]第五十章 故事板”中讨论了如何使用代码创建简单动画,以及如何使用XAML标记构建更复杂的故事板——具有多个动画以及播放控制功能.但有时采用更复杂的故事板例程,并在代码中实现全部复杂功 ...
- Silverlight & Blend动画设计系列五:故事板(StoryBoards)和动画(Animations)
正如你所看到的,Blend是一个非常强大的节约时间的设计工具,在Blend下能够设计出很多满意的动画作品,或许他具体是怎么实现的,通过什么方式实现的我们还是一无所知.本篇将续前面几篇基础动画之上,详细 ...
- 故事板(StoryBoards)和动画(Animations)
Silverlight & Blend动画设计系列五:故事板(StoryBoards)和动画(Animations) 正如你所看到的,Blend是一个非常强大的节约时间的设计工具,在Blend ...
- iOS系列 基础篇 02 StoryBoard 故事板文件
iOS基础 02 StoryBoard 故事板文件 目录: 1. 故事板的导航特点 2. 故事板中的Scene和Segue 3. 本文最后 在上篇HelloWorld工程中有一个Main.storyb ...
- (译)Getting Started——1.2.4 Tutorial:Storyboard(故事板)
该教程是基于你在前面的课程中构建的项目上进行的.学完本教程后,你将使用你前面学到的视图.视图控制器.动作.导航的内容,还会为应用创建一些关键的用户界面,并在场景中添加行为 以下就是本节课的内容: 1. ...
随机推荐
- Linux课程---6、别名管理和网络配置(Linux命令如何记)
Linux课程---6.别名管理和网络配置(Linux命令如何记) 一.总结 一句话总结: 理解记忆:因为命令要实现那么多功能,必须有那么多参数,而不同的参数就适用不用的情况 命令基本格式:命令关键字 ...
- hdu-5583 Kingdom of Black and White(数学,贪心,暴力)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5583 Kingdom of Black and White Time Limit: 2000/1000 ...
- [基本操作]线段树分治和动态dp
不知道为什么要把这两个没什么关系的算法放到一起写...可能是都很黑科技? 1.线段树分治 例题:bzoj4026 二分图 给你一个图,资瓷加一条边,删一条边,询问当前图是不是二分图 如果用 LCT 的 ...
- 【转】 Pro Android学习笔记(五八):Preferences(2):CheckBoxPreference
目录(?)[-] CheckBox Preference xml文件 设备的存贮文件 复合preference 在ListPreference的例子中显示的是单选,如果是多选,可采用CheckBoxP ...
- myeclipse保存时弹出Building workspace
最近做项目,每次保存修改的东西.myeclipse都会building workspace(重新编译)一下.并且那 building的速度真不够慢的啊. 严重影响编程速度. 在网上也发现遇到此问题的很 ...
- CI框架 Fatal error: Call to undefined method CI_DB::CI_DB() in D:\xinqing\web\CodeIgniter\database\drivers\odbc\odbc_driver.php on line 53
Fatal error: Call to undefined method CI_DB::CI_DB() in D:\xinqing\web\CodeIgniter\database\drivers\ ...
- sql 查看表结构
sqlserver 查看表结构 exec sp_help @TableName --得到表信息.字段,索引.constraint. exec sp_pkeys @TableName --得到主键. e ...
- JavaScript接口
JavaScript中实现接口的方法有三种: 第一种,使用注释的方法实现接口 特点:(1)最简单,但是功能最弱(2)利用 interface和 implement"文字"(3)把他 ...
- 安装zendstudio和破解方法及配置svn
下载zendstudio12文件http://www.zendstudio.net/zend-studio-all-in-one-download/ 下载破解补丁http://pan.baidu.co ...
- C# 将html实体编码转换到正常字符 & #40;格式
获取到html实体编码字符后,通过正则获取其中的html实体编码,再统一强制转换到正常字符: 代码如下: string strformat = item.value7; //将html实体编码转换到正 ...