当前位置:编程学习 > wap >>

WP7:模拟开始屏幕Tile漂动效果

在WP7手机的开始屏幕,如果你Hold住某一个瓷贴,就会发现除了你按住的那个瓷贴其他全部下沉半透明,然后开始在不停地漂来漂去~~
今天来模仿一下这个效果。
新建一个项目,然后在Grid里放一个ListBox。
OK 开始编写 ListBox 的模版。
首先是ItemsPanelTemplate。
<ListBox.ItemsPanel>
         <ItemsPanelTemplate>
                 <toolkit:WrapPanel/>
         </ItemsPanelTemplate>
</ListBox.ItemsPanel>
我们放一个WrapPanel,让它进行自动排列和换行。
然后就是主要的 ItemTemplate。
 
<ListBox.ItemTemplate>
                    <DataTemplate>
                        <Canvas Width="185" Height="185">
                        <Grid x:Name="grid">
                            <Grid.RenderTransform>
                                <TranslateTransform/>
                            </Grid.RenderTransform>
                            <Grid.Resources>
                                <Storyboard x:Name="sbTranslate">
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                            <EasingDoubleKeyFrame x:Name="translateX" KeyTime="00:00:1" Value="0">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <SineEase EasingMode="EaseInOut"/>
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                                    </DoubleAnimationUsingKeyFrames>
                                    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                            <EasingDoubleKeyFrame x:Name="translateY" KeyTime="00:00:1" Value="0">
                                            <EasingDoubleKeyFrame.EasingFunction>
                                                <SineEase EasingMode="EaseInOut"/>
                                            </EasingDoubleKeyFrame.EasingFunction>
                                        </EasingDoubleKeyFrame>
                         &nb

补充:移动开发 , Windows Phone ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,