我尝试在SwipeView中添加的动画。尽管它们可以工作,但让SwipeView滑动起来要困难得多,而且需要一些好的时机才能让元素滑动……
你知道怎么解决这个问题吗?我甚至尝试过通过xct:TouchEffect.IsAvailable隐藏TouchEffects,但是,无论是否可见,只要TouchEffects在视图中,错误就会继续存在。
如果您能推荐一种适用于SwipeViews的替代动画方法,我将不胜感激
发布于 2021-11-19 02:22:03
根据您的声明,由于添加了触摸方法,您在使用它时似乎有一个糟糕的体验。
你可以使用xct:TouchEffect.LongPressCommand来避免意外的触摸操作。
设置点击一定时间后触发方法,避免滑动时触发点击方法。
下面是xaml代码:
<StackLayout>
<SwipeView xct:TouchEffect.LongPressCommand="{Binding LongPressedCommand}" xct:TouchEffect.LongPressDuration="500">
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem Text="Favorite"
IconImageSource=""
BackgroundColor="LightGreen"
/>
<SwipeItem Text="Delete"
IconImageSource=""
BackgroundColor="LightPink"
/>
</SwipeItems>
</SwipeView.LeftItems>
<Grid HeightRequest="60"
WidthRequest="300"
BackgroundColor="LightGray">
<Label Text="Swipe right"
HorizontalOptions="Center"
VerticalOptions="Center" />
</Grid>
</SwipeView>
</StackLayout>使用xct:TouchEffect.LongPressDuration="500"设置触发时间,单位为毫秒。
https://stackoverflow.com/questions/70024319
复制相似问题