与Net MAUI有长期接触效应,有关于Github的建议,将这种影响列入MAUI 社区工具包。 根据最新消息,很快将执行。
作为替代工作,你可以设法找到MAUI控制手,然后获得<代码>handler.Platform。 观点代码>是本土控制。 之后,你可以援引本土控制方法,并赞同诸如姿态活动等本土控制活动,见.NET MAUI与操作员控制,并提及以下守则:
www.un.org/Depts/DGACM/index_spanish.htm a. 用地图仪进行控制(在图像控制方面有效):
Microsoft.Maui.Handlers.ImageHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
{
#if WINDOWS
handler.PlatformView.Holding += PlatformView_Holding;
#endif
#if ANDROID
handler.PlatformView.LongClick += PlatformView_LongClick;
#endif
#if IOS
handler.PlatformView.UserInteractionEnabled = true;
handler.PlatformView.AddGestureRecognizer(new UILongPressGestureRecognizer(HandleLongClick));
#endif
});
www.un.org/Depts/DGACM/index_spanish.htm 执行 每个平台的长期新闻活动:
#if WINDOWS
private void PlatformView_Holding(object sender, Microsoft.UI.Xaml.Input.HoldingRoutedEventArgs e)
{
//Touch can produce a Holding action, but mouse devices generally can t.
//see https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.holding?view=winrt-22621
}
#endif
#if IOS
private void HandleLongClick(UILongPressGestureRecognizer sender)
{
//raise longpress event
}
#endif
#if ANDROID
private void PlatformView_LongClick(object sender, Android.Views.View.LongClickEventArgs e)
{
//raise longpress event
}
#endif
参考资料:https://learn.microsoft.com/en-us/answers/questions/90059/8long-press-in-net-maui