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代码大全
事件源对象 event.srcElement.tagName event.srcElement.type 捕获释放 event.srcElement.setCapture(); event.srcEl ...
- 30个你不可不知的CSS选择器
30个你不可不知的CSS选择器 一.五大基本选择符 1. *(通配符)*通配符选择器,经常用于css reset(样式重置),清理标签的默认样式,但现在一般不提倡直接使用*了,主要是*会匹配所有标 ...
- ajax.request函数使用详解
Ajax.Request ? Ajax.Request( url, { method:method, parameters:para, postBody:xmlString, asynchrono ...
- 点击上下页,实现图片滚动的jquery代码
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content=&q ...
- 原生JS研究:学习jquery源码,收集整理常用JS函数
原生JS研究:学习jquery源码,收集整理常用JS函数: 1. JS获取原生class(getElementsByClass) 转自:http://blog.csdn.net/kongjiea/ar ...
- ubuntu下lnmp的安装
适用于ubuntu14.04和源是14.04的ubuntu上安装nginx(我学在线Moodle工作室---注这里安装的是最新版的nginx,并且解决pathinfo问题,特别适用于Moodle安装) ...
- C++ Primer第四版 15.9 再谈文本查询 程序实现
编程过程中发现书本中的示例程序并不完全,某些地方存在错误,现已改正并添加少许注释.. 1 #include<iostream> 2 #include<fstream> #inc ...
- Oracle EBS-SQL (WIP-9):检查车间任务超发料.sql
select WE.WIP_ENTITY_NAME 任务号, MFG_LOOKUPS_WJS.MEANING ...
- C#句柄使用
原文:C#句柄使用 调用 API 函数 SendMessage 发送 WM_CLOSE 消息. DllImport("User32.dll",EntryPoint="Se ...
- 【Android】自带Theme
[Android]自带Theme android之uses-permission 在编写Android程序时经常会忘记添加权限,下面是网上收集的关于Android uses-permission的 ...