Windows phone 7 单击时的动画

Windows phone 7 单击时的动画,windows-phone-7,Windows Phone 7,我已经将MouseLeftButtonUp事件添加到画布以捕获点击(或触摸)事件。现在,当单击画布时,没有任何迹象表明用户已经单击了画布(意味着没有按下的效果)。单击画布时如何创建这样的效果 对于画布来说,这将是一个棘手的问题。你不能用按钮代替吗?您可以将画布的内容放在按钮内容中。然后,您可以使用按钮的视觉状态来指示按下按钮的时间 或者,您可以在控件上使用操纵事件,并相应地更改其外观。如果已安装工具箱,则可以通过设置 toolkit:TiltEffect.IsTiltEnabled="True"

我已经将MouseLeftButtonUp事件添加到画布以捕获点击(或触摸)事件。现在,当单击画布时,没有任何迹象表明用户已经单击了画布(意味着没有按下的效果)。单击画布时如何创建这样的效果

对于画布来说,这将是一个棘手的问题。你不能用按钮代替吗?您可以将画布的内容放在按钮内容中。然后,您可以使用按钮的视觉状态来指示按下按钮的时间


或者,您可以在控件上使用操纵事件,并相应地更改其外观。

如果已安装工具箱,则可以通过设置

toolkit:TiltEffect.IsTiltEnabled="True"
然后你需要用一个控件,比如一个按钮来包装你的画布

我实际上使用了ListBoxItem来接收倾斜效果。:)


您可以尝试从download.microsoft.com下载示例项目。它包含TiltEffect.cs,您可以将其添加到自己的项目中,例如在.xaml文件中(请参见最后一行):


        <ListBoxItem Style="{StaticResource ListBoxItemStyle}">
            <Canvas Margin="{StaticResource PhoneVerticalMargin}" Background="Transparent">
                <Custom:Interaction.Triggers>
                    <Custom:EventTrigger EventName="MouseLeftButtonDown">
                        <ic:NavigateToPageAction TargetPage="/Views/xxxView.xaml" />
                    </Custom:EventTrigger>
                </Custom:Interaction.Triggers>
<phone:PhoneApplicationPage 
    x:Class="NavigationTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:NavigationTest" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    local:TiltEffect.IsTiltEnabled="True">