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. ...
随机推荐
- 【python】关于函数递归使用 return 后,收到数据为 None。
在写一个辗转相除求最小公因数的程序的时候,突然发现自己不管怎么写(除了两数恰巧可以整除),return 返回的值恒为 none. 代码为此: def gcd(a,b): if a%b==0: retu ...
- director.js实现前端路由
注:director.js的官网 https://github.com/flatiron/director director.js是什么? 理解:前端的route框架,director.js客户端的路 ...
- Java微信开发_Exception_03_非微信官方网页-invalid signature
由于natapp免费隧道的域名是系统随机分配的,老是在变.故昨天又换了内网映射工具,分别换了ngrok和花生壳,然而在做JSSDK网页开发时,按了微信的view菜单按钮进行页面跳转时,微信官方提示“非 ...
- 【HDU 6428】Calculate 莫比乌斯反演+线性筛
题解 代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1LL&l ...
- 04 - Django应用第一步
知识点 1) 创建项目命令 以及项目结构介绍 2) 创建应用程序命令 应用, 项目的区别 以及应用程序结构 3) 启动项目命令 4) URLs的编写 include()的使用 get发送参数的格式 u ...
- CF510E. Fox And Dinner
CF510E. Fox And Dinner https://codeforces.com/contest/510 分析: 由于\(a_i>2\), 相邻两个数一定一奇一偶,按奇偶建立二分图. ...
- ACM学习历程—POJ 3764 The xor-longest Path(xor && 字典树 && 贪心)
题目链接:http://poj.org/problem?id=3764 题目大意是在树上求一条路径,使得xor和最大. 由于是在树上,所以两个结点之间应有唯一路径. 而xor(u, v) = xor( ...
- ACM学习历程—HDU5478 Can you find it(数论)(2015上海网赛11题)
Problem Description Given a prime number C(1≤C≤2×105), and three integers k1, b1, k2 (1≤k1,k2,b1≤109 ...
- SparkWriteToHFile
1. HFile的LoadIncrement卡住 原来是因为权限,我一直以为,load函数之后是要删除文件的,但是hdfs://slave1:8020/test/info文件夹所有的是只读权限,而且考 ...
- 有关HL7 的C# 源码
https://github.com/OSEHRA/mdo C# http://sourceforge.net/p/nhapi/code/HEAD/tree/NHapi20/ ...