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=& ...
随机推荐
- Java的redis控制台-Jedis
jedis 源码地址:https://github.com/xetorthio/jedis
- JavaScript: apply 方法 详解(转)——非常好
转载自 http://www.cnblogs.com/KeenLeung/archive/2012/11/19/2778229.html 我在一开始看到javascript的函数apply和call ...
- 20154312《网络对抗》Exp2 后门原理与实践
常见问题快速链接 Handler failed to bind to xxx.xxx.xx.xxx:xxxx 使用Webcam_snap命令提示1411错误,无法正常拍照 常用后门工具实践 Windo ...
- isKindOfClass和isMemberOfClass 的区别
判断对象类型 -(BOOL) isKindOfClass: classObj判断是否是这个类或者这个类的子类的实例 -(BOOL) isMemberOfClass: classObj 判断是否是这个类 ...
- 数据仓库基础(九)Informatica小技巧(1)
本文转载自:http://www.cnblogs.com/evencao/p/3148373.html link path:查看某个字段的来源去处,非常有参考的价值.右击你想要看的字段,选择 sele ...
- git必备命令
git status 查看git的状态git add <path>的形式把我们<path>添加到索引库中,<path>可以是文件也可以是目录.git add -u ...
- Struts2 Spring Hibernate 框架整合 Annotation MavenProject
项目结构目录 pom.xml 添加和管理jar包 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns ...
- Python入门之python可变对象与不可变对象
本文分为如下几个部分 概念 地址问题 作为函数参数 可变参数在类中使用 函数默认参数 类的实现上的差异 概念 可变对象与不可变对象的区别在于对象本身是否可变. python内置的一些类型中 可变对象: ...
- 20145312《网络对抗》MSF基础
20145312<网络对抗>MSF基础 实验要求 1.掌握metasploit的基本应用方式 2.掌握常用的三种攻击方式的思路 实验问答 用自己的话解释什么是exploit.payload ...
- 实验二 Java 面向对象程序设计
实验内容 1 初步掌握单元测试和TDD 2 理解并掌握面向对象三要素:封面,继承,多态 3 初步掌握UML建模 4 熟悉SOLID原则 5 了解设计模式 (一)单元测试 D