具有项目点击动画的长列表选择器

use*_*563 1 c# silverlight wpf windows-phone windows-phone-8

我正在努力Windows Phone 8,我有很长的列表选择器,其中包含很少的项目.当我点击我需要添加一些动画的项目时,移动文本并返回.如何实现这一目标?我也试图将相同的内容应用于列表框.

我试过这个:

<Style x:Key="LongListSelectorStyle1" TargetType="phone:LongListSelector">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <UserControl>
                            <Border x:Name="MyBorder" Background="Transparent">
                                <VisualStateManager.VisualStateGroups  >
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="Selected">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background)" Storyboard.TargetName="MyBorder">
                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="#000000"/>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                            </Border>
                        </UserControl>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

以下是示例截图

在此输入图像描述

我怎样才能实现这一目标?

Mat*_*hew 5

我会尝试使用WPToolkit,其中有一个选项,您可以在按下ListBox或LongListSelector中的项目时应用"倾斜"动画.很酷.首先,您需要通过Visual Studio中的NuGet获取工具包https://www.nuget.org/packages/WPtoolkit/4.2013.8.16(该站点的链接,但您使用Visual Studio本身内的程序包管理器控制台添加它并且它自动设置一切).检查此链接http://www.davidsalter.com/2013/09/using-windows-phone-toolkit-in-wp8.html,一旦你拥有它,在标签内你可以声明ListBox或LongListSelector本身,插入以下

`<ListBox ... toolkit:TiltEffect.IsTiltEnabled="True" ../>
Run Code Online (Sandbox Code Playgroud)

这应该工作.