在Windows Phone 8应用程序中,我想在选择项目时使用Windows Phone Store应用程序中使用的动画/转换/效果。
这里是动画/过渡的解释:
我很确定我已经在其他几个应用上看到了这种效果。所以我的问题可能是愚蠢的,但SDK中是否有方法或某些东西来执行此效果/动画/转换,或者我应该做什么"手动" ?
提前感谢您提供有关该主题的提示!
答案 0 :(得分:0)
有些时候我也搜索过这个,但找不到我需要申请的模板才能得到相同的结果。
最后,我正在创建自己的动画以获得类似的效果。 我有一个Button控件,用于我的列表中的选择。对于按钮模板,我应用了我自己的样式,其中包含以下对视觉状态更改的定义:
您可以在Blend中创建按钮模板和样式模板。
<Style x:Key="LongListSelectorButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.Y)"
Storyboard.TargetName="ButtonBackground"
From="0"
To="-6"
Duration="00:00:0.04"/>
<DoubleAnimation Storyboard.TargetProperty="(Border.RenderTransform).(TranslateTransform.X)"
Storyboard.TargetName="ButtonBackground"
From="0"
To="2"
Duration="00:00:0.04"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
此动画会将按钮从当前位置向右移动一点。您可以将动画更改为任何其他方向。