silverlight控件动画状态的过渡
动画代码:
xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="FocusStateGroup">
<vsm:VisualState x:Name="Focus">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1.1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.95" KeySpline="0,0,0.5,1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value=""/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1.1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.95" KeySpline="0,0,0.5,1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value=""/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Unfocus">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.95" KeySpline="0,0,0.5,1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value=""/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.95" KeySpline="0,0,0.5,1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value=""/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
后台代码触发动画,并让其从第一个状态过渡到第二个状态
private void AddContactButton_MouseEnter(object sender, MouseEventArgs e)
{
VisualStateManager.GoToState(this, "Focus", true);
} private void AddContactButton_MouseLeave(object sender, MouseEventArgs e)
{
VisualStateManager.GoToState(this, "Unfocus", true);
} protected void InitEvents()
{
base.MouseEnter+=(new MouseEventHandler(this.AddContactButton_MouseEnter));
base.MouseLeave+=(new MouseEventHandler(this.AddContactButton_MouseLeave));
}
silverlight控件动画状态的过渡的更多相关文章
- Windows Store App 控件动画
在开发Windows应用商店应用时,开发工具中已经封装了大量的控件供开发人员使用,而其中有一部分控件,例如FlipView.ToolTip.ListView以及SemanticZoom等控件中已经默认 ...
- (转)Silverlight控件关系理解
原文地址http://www.cnblogs.com/Joetao/articles/1899664.html 本篇学习了Silverlight中的控件继承关系,了解控件的继承关系对应我们操作控件,使 ...
- 仿酷狗音乐播放器开发日志二十三 修复Option控件显示状态不全的bug(附源码)
转载请说明原出处,谢谢~~ 整个仿酷狗工程的开发将近尾声,现在还差选项设置窗体的部分,显然在设置窗体里用的最多的就是OptionUI控件,我在写好大致的布局后去测试效果,发现Option控件的显示效果 ...
- Android自己定义控件(状态提示图表)
[工匠若水 http://blog.csdn.net/yanbober 转载烦请注明出处.尊重分享成果] 1 背景 前面分析那么多系统源代码了.也该暂停下来歇息一下,趁昨晚闲着看见一个有意思的需求就操 ...
- silverlight 控件样式动态绑定
<telerik:RadDiagram x:Name="diagram1" GraphSource="{Binding GraphSource, Mode=TwoW ...
- silverlight控件阴影效果示例
<ScrollViewer MaxHeight="400" VerticalScrollBarVisibility="Auto" HorizontalSc ...
- silverlight 控件自定义样式 实现方法
1:在app.xaml中加入需实现的样式,如: <Application.Resources> <Style x:Key="NodeStyle" TargetTy ...
- Android 开发学习进程0.15 adb cardview framelayout 控件设置状态获取焦点
Android设备调试桥 即adb 使用adb进行无线调试的一些常用命令 adb tcpip 5555 设置调试端口为5555 防止冲突 adb shell ifconfig wlan0 查询局域网中 ...
- Silverlight控件——如何提升应用程序信任度与问题解决
从silverlight5开始,可以在项目设置中勾选“在浏览器内运行时需要提升的信任”来达到在浏览器内运行提权silverlight客户端的目的,在个特性很有用处. 可我使用这个功能时遇到了一个奇怪的 ...
随机推荐
- js callback函数
A callback is a function that is passed as an argument to another function and is executed after its ...
- 仅当使用了列的列表并且 IDENTITY_INSERT 为 ON 时,才能为表'SpeType'中的标识列指定显式值
尊重原著作:本文转载自http://blog.163.com/lao12qi12345%40126/blog/static/1179155120101122113316187/ 情况描述 在表Tab ...
- CoreLocation导航Demo
CoreLocation实现定位和导航功能还是非常简单的,基本思路是: 1.导入<CoreLocation/CoreLocation.h>头文件 2.使用该框架内的导航管理者,创建该导航管 ...
- 在ios8上 [TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用 经过测试加入下面方法 在ios7 8上都可以正常工作
-(void)viewDidLayoutSubviews { if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)] ...
- TCP/IP详解之:TCP
第17章 TCP:传输控制协议 TCP提供了一种可靠的面向连接的字节流运输层服务 TCP的服务 尽管TCP和UDP都使用相同的网络层(IP),TCP却向应用层提供与UDP完全不同的服务. TCP通过下 ...
- Python基础:绑定和方法调用
首先,方法仅仅是类内部定义的函数,也就是说,方法是类属性而不是实例属性. 其次方法有两种被调用的方式:调用绑定的方法和调用未绑定的方法. 当存在一个实例时,方法才被认为绑定到了那个实例上,没有实例时方 ...
- grep 和 perl多个条件匹配
grep和perl多个条件匹配使用‘|’作为分割符号 grep -E 'abc|def' perl if(/abc|def/)
- AOP面试遇到的问题
1.什么是AOP? 面向切面的编程,找出纸和笔,画一个箭头,两道竖线将这个箭头砍断,这就是AOP 举例来说,某个方法正在运行呢,要想在前面加个日志,加在这里,后面加个日志,加在这里,前面加transa ...
- Android_BitmapShader实现圆形、圆角图片
转:http://blog.csdn.net/lmj623565791/article/details/41967509,本文出自:[张鸿洋的博客] 1.概述 记得初学那会写过一篇博客Android ...
- phpcms 任意位置获取用户头像
主要拿到userid $_username = param::get_cookie('_username');//当前登录人用户名 $_userid = param::get_cookie('_use ...