public enum SwipeDirection
{
None,
LeftToRight,
RightToLeft,
TopToBottom,
BottomToTop
}
用法示例:
<SwipeArea OnSwipe="OnSwipe" Class="h-100 pt-1">
@* wrap the area that you want to detect swipe gestures in SwipeArea component *@
</SwipeArea>
@code {
private SwipeDirection _swipeDirection = SwipeDirection.None;
private void OnSwipe(SwipeDirection swipeDirection)
{
_swipeDirection = swipeDirection;
// do stuff based on swipe direction
}
}
2条答案
按热度按时间hwamh0ep1#
.NET Maui Blazor Hybrid
没有内置的滑动手势支持。您可以通过处理各种@ontouch***
EventCallback
来创建自己的解决方案。下面是一个非常基本的SwipeArea
组件实现:一米四分一秒
滑动方向.cs:
用法示例:
xqk2d5yq2#
现在当你在MAUI中使用Blazor时,你可以使用MudBlazor的SwipeArea。刚刚在我的应用程序中测试过,它工作起来很有魅力!