Disabling tap animation in ListView in WP 8.1

微笑、不失礼 提交于 2019-12-11 03:27:00

问题


In WP 8.1, how do I remove the default animation in ListView when an item is tapped and it's skewed/translated in different directions depending on where the tap occurs? I want no item click animation.


回答1:


The animation comes from the ListView's ItemContainerStyle's "Pressed" state.

In the designer select your ListView, right click, and choose "Edit Additional Templates.Edit Generated Item Container (ItemContainerStyle).Edit a copy..."

This will generate a style with TargetType="ListViewItem":

<Style x:Key="ListViewItemStyle1" TargetType="ListViewItem">

In the style find the Visual State for "Pressed" and alter or remove the animation:

<VisualState x:Name="Pressed">
    <Storyboard>
        <!--<PointerDownThemeAnimation Storyboard.TargetName="TiltContainer"/>-->
    </Storyboard>
</VisualState>

If you want to replace the animation rather than just removing it then Blend is an excellent tool for editing Visual States and animations. If you're supporting clicking or tapping then you should provide some indication to the user what is going on, but you can change it here to what you need. You can also alter other VisualStates as needed.



来源:https://stackoverflow.com/questions/27030182/disabling-tap-animation-in-listview-in-wp-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!