Disabling tap animation in ListView in WP 8.1

2019-07-12 13:53发布

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条回答
beautiful°
2楼-- · 2019-07-12 14:15

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.

查看更多
登录 后发表回答