2011-04-19 102 views
0

我已将MouseLeftButtonUp事件添加到画布以捕获点击(或触摸)事件。现在,当点击画布时,用户没有指示他点击了画布(意味着没有按下的效果)。点击画布时如何创建这种效果。动画,同时点击

回答

0

对于一个画布,这将是棘手。你可以不使用按钮吗?您可以将画布的内容放入按钮内容中。然后,您可以使用该按钮的视觉状态来指示它正在被按下时。

或者,您可以使用控件上的操作事件并相应地改变它的外观。

0

如果你已经安装该工具包,您可以设置通过设置

toolkit:TiltEffect.IsTiltEnabled="True" 

使TiltEffect,然后你将需要与控制,比方说,一个按钮来包装你的画布。

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

 <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> 
0

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

<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">