WPF StoryBoard用法
StoryBoard使用,Xaml转cs代码
<EventTrigger RoutedEvent="Image.MouseLeftButtonDown">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard Storyboard.TargetName="image1"
Storyboard.TargetProperty="(Canvas.Left)" >
<DoubleAnimation AutoReverse="True"
RepeatBehavior="Forever"
BeginTime="0"
Duration="0:0:20" From="0" To="-1100">
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Canvas.Triggers>
转换为cs代码:
this.image1.Name = "image1";
NameScope.SetNameScope(this,new NameScope());
this.RegisterName(this.image1.Name,this.image1);
DoubleAnimation xAnimation = new DoubleAnimation();
xAnimation.From = 0;
xAnimation.To = -1100;
xAnimation.Duration = new Duration(TimeSpan.FromSeconds(30));
DependencyProperty[] propertyChain = new DependencyProperty[]
{
Image.RenderTransformProperty,
TranslateTransform.XProperty
};
Storyboard story = new Storyboard();
story.AutoReverse = true;
story.RepeatBehavior = RepeatBehavior.Forever;
story.Children.Add(xAnimation);
Storyboard.SetTargetName(xAnimation,this.image1.Name);
Storyboard.SetTargetProperty(xAnimation,new PropertyPath("(0).(1)",propertyChain));
story.Begin(this);
WPF StoryBoard用法的更多相关文章
- Wpf(Storyboard)动画简单实例
原文:Wpf(Storyboard)动画简单实例 动画的三种变换方式 RotateTransform:旋转变换变化值:CenterX围绕转的圆心横坐标 CenterY纵坐标 Angle旋转角度(角度正 ...
- wpf Storyboard 不存在可解析名称“ ”的适用名称领域 No applicable name scope exists to resolve the name
原文:wpf Storyboard 不存在可解析名称“ ”的适用名称领域 No applicable name scope exists to resolve the name 写了一个 Storyb ...
- WPF DataTriger 用法示例代码
用法1: <DataGridTemplateColumn Header="{lex:LocText ExamineRoom}"> <DataGridTemplat ...
- WPF Storyboard 动画播放完毕时触发的事件
/*故事版*/ Storyboard ClSto2; public PopUpWindow() { /*播放完毕,将当前窗体关闭*/ ClSto2.Completed += (s, e) => ...
- 【转】【WPF】WPF绑定用法
一.简介 为了后面行文顺利,在进入正文之前,我们首先对本文所涉及到的绑定知识进行简单地介绍.该节包含绑定的基本组成以及构建方式. WPF中的绑定完成了绑定源和绑定目标的联动.一个绑定常常由四部分组成: ...
- (WPF)Storyboard
Storyboard是一个为其所包括的动画提供目标信息的容器. 除非动画放在Storyboard中,负责不能在XMAL中被实例化. BeginStoryboard通过将Storyboard加入到触发器 ...
- WPF ICommand 用法
基础类,继承与ICommand接口 using System; using System.Collections.Generic; using System.Linq; using System.Te ...
- WPF DataGrid 用法
XAML==> <Window x:Class="QueueSystem.MainWindow" xmlns="http://schemas.microsof ...
- WPF中StringFormat 格式化 的用法
原文 WPF中StringFormat 格式化 的用法 网格用法 <my:DataGridTextColumn x:Name="PerformedDate" Header=& ...
随机推荐
- Detour的简单使用
Detours的安装:下载部分:1.直接在百度搜"detour",进对应的网站下载.2.或以下链接https://www.microsoft.com/en-us/research/ ...
- ngxin开启rewrite伪静态
1.编辑nginx配置文件 vi /usr/local/nginx/conf/nginx.conf #include enable-php.conf; include enable-php-pathi ...
- [转载] My97DatePicker日历实现开始日期小于结束日期验证
<tr align='center'> <td align="right">开始日期: </td> <td align="lef ...
- nginx反向代理-后端服务器组设置
nginx服务器的反向代理时其最常用的重要功能之一,在实际工作中应用广泛,涉及的配置指令也比较多.下面会尽量详细地介绍对应的指令,及其使用状态. 反向代理一般是互联网需要向内网拉取资源,比如访问一个w ...
- Python入门之Python引用模块和查找模块路径
#这篇文章主要介绍了Python引用模块和Python查找模块路径的相关资料,需要的朋友可以参考下 模块间相互独立相互引用是任何一种编程语言的基础能力.对于“模块”这个词在各种编程语言中或许是不同的, ...
- UVA12558 Egyptian Fractions (HARD version) (埃及分数,迭代加深搜索)
UVA12558 Egyptian Fractions (HARD version) 题解 迭代加深搜索,适用于无上界的搜索.每次在一个限定范围中搜索,如果无解再进一步扩大查找范围. 本题中没有分数个 ...
- C++设计模式 之 “单一职责”模式:Decorator、Bridge
part 1 “单一职责”模式 在软件组件的设计中,如果责任划分的不清晰,使用继承得到的结果往往是随着需求的变化,子类急剧膨胀,同时充斥着重复代码,这时候的关键是划清责任. 典型模式 Decorato ...
- VC 线程池
参照:http://www.cnblogs.com/kzloser/archive/2013/03/11/2909221.html 参照:http://blog.csdn.net/pjchen/art ...
- Entity Framework 6 和 MVC5
网站地址: Entity Framework 6 http://msdn.microsoft.com/en-us/data/ef.aspx MVC5 http://www.asp.net ...
- [BZOJ1776][Usaco2010 Hol]cowpol 奶牛政坛
Description 农夫约翰的奶牛住在N (2 <= N <= 200,000)片不同的草地上,标号为1到N.恰好有N-1条单位长度的双向道路,用各种各样的方法连接这些草地.而且从每片 ...