gpt4 book ai didi

animation - 将指针向上/向下效果应用于 Windows Phone 8.1 应用程序

转载 作者:行者123 更新时间:2023-12-02 11:27:24 24 4
gpt4 key购买 nike

我已将 Windows Phone 8 应用程序迁移到 Windows Phone 8.1 运行时。显然包括倾斜效果。我如何将其添加到自定义控件中?

谢谢

最佳答案

因此,您的目标是 rintime,您可以查看 Windows.UI.Xaml.Media.Animation classes特别是:PointerDownThemeAnimationPointerUpThemeAnimation - 那里有简单的例子。

您要做的主要是将这些动画放入 VisualStates 和 VisualTransitions 中,简单的示例如下所示:

<Style x:Key="myControl" TargetType="Button">
<Setter Property="Padding" Value="0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent" Name="Grid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Pressed" To="PointerOver">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
<VisualTransition From="PointerOver" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
<VisualTransition From="Pressed" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

关于animation - 将指针向上/向下效果应用于 Windows Phone 8.1 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23965604/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com