English 中文(简体)
替代锡马林社区工具包
原标题:Alternative to xamarin community toolkit toucheffect maui

does anybody knows if there is a workaround for using long touch with DotNet MAUI? In my legacy app build with Xamarin, i was using xct:TouchEffect.LongPressCommand.

就我所知,在MAUI社区工具包中有一种主人,但此时此刻这套工具并不可行。

Maybe using EventToCommandBehaviour? What will be the name of the event if i use this?

Is there a way to extend for exemple ImageHandler with propertyMapper and CommandMapper to achieve this goal? Maybe someone has an other idea? Thanks by advance for any suggestion ?

问题回答

与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





相关问题
Android ListView partial pressable areas

I would like to create a ListView item layout where I can touch certain portions of a line item. This is similar to the behavior of the 2.0 s Contacts Call Log where I can click on the green phone ...

Disable touch events while processing

I have a button which should not be clicked by user, when some processing is going on [shown using UIActivityIndicatorView]. For this when the processing starts i call [[UIApplication ...

How to know TabletPC is in Laptop or Tablet mode

I m writing a Touch-enable application for DELL TX2, for text input, I need to know whether the TablePC is in Laptop or Tablet mode, then change the text input mode. In Latop mode, don t call ...

box2d: bigger clickable/touchable area

I m using Box2D on my iPhone app using Cocos2D. I m using mouse joint to drag objects by touch. The touch event is handled to find the corresponding Box2D body using AABB queries. I would want to ...

touchesMoved behavior in iPhone and Simulator

The function touchesMoved behaves differently in iPhone and simulator. The repeating interval (refresh rate) of the function touchesMoved is much faster than simulator. Is there a way to deal with ...

how to get touch event on imageView of UITableViewCell?

I want to get notifications when user single tap or double tap on imageView of UITableViewCell. I have been try to add a subview to imageView, and use touchesBegan:withEvent: in subview controller, ...

get touch coordinates (in the form of 0-480 and 0-320)

i dont get how to translate the coordinates of the iphone. if i make a single touch i get the coordinate. if i make a touch and keep it and release it it shows the difference of the starting and end ...

热门标签