当前位置: 移动技术网 > 移动技术>移动开发>WP > Windows Phone7程序控件使用Tilt(倾斜)效果

Windows Phone7程序控件使用Tilt(倾斜)效果

2018年10月15日  | 移动技术网移动技术  | 我要评论

 

windows phone7 模拟器自带的settings等应用的列表等控件, 点击时有tilt倾斜的效果, 我们自己写的demo默认控件是没有这种效果,显得风格与不一致,查了一msdn,发现这种效果叫tilt,并且官方有一个demo:

倾斜特效(tilt effect)示例

windows phone 控件的倾斜特效(tilt effect)为您在普通的控件交互中提供了更加丰富的可视化反馈。当控件被触摸时,它提供了一个“倾斜”状的反馈。控件倾斜特效示例展示了如何在一个应用程序当中实现这种倾斜特效。有关更多如何在应用程序中增加倾斜特效的更多信息,请查看control tilt effect for windows phone。

下载示例

 

如何在自己的项目增加tilt效果呢,可以看看这个

how to: use the control tilt effect for windows phone

 

其实就是以下几步:

1、在项目中增加  tilteffect class ,可以从demo中直接复制文件

2、在xaml文件mainpage.xaml开头增加 红色的2句

<phone:phoneapplicationpage

    x:class="helloworld.mainpage"

    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="https://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="https://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"

    xmlns:local="clr-namespace:controltilteffect"

    mc:ignorable="d" d:designwidth="480" d:designheight="696"

    fontfamily="{staticresource phonefontfamilynormal}"

    fontsize="{staticresource phonefontsizenormal}"

    foreground="{staticresource phoneforegroundbrush}"

    supportedorientations="portrait" orientation="portrait"

    shell:systemtray.isvisible="true"

    local:tilteffect.istiltenabled="true">

3、如果某个控件不想要tilt效果,则设置local:tilteffect.suppresstilt="true"

例如

<button content="button (suppressed)" height="150" horizontalalignment="left" margin="37,0,0,161" verticalalignment="bottom" width="380" local:tilteffect.suppresstilt="true"/>

 

挺简单吧,如果还是不清楚自己好好看官方的英文文档吧

摘自:offbye的技术博客

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网