If one does a GeoViewHolding on the map a magnifier pops up. In FieldMaps that gets handled and implements the Dropped pin behavior.
I am trying to implement something similar but I cannot see what event is triggered after the magnifier appears and the user releases. The SDK seems to already be implementing the behavior for the magnifier, but what event handler does one implement to capture the release
Hi,
You can switch off magnifier and implement your workflow on GeoViewHolding. Code below:
// In MainPage constructor
mapView.InteractionOptions = new MapViewInteractionOptions()
{
IsMagnifierEnabled = false, // Disable magnifier.
};
I want the magnifier. I want to be able to have the magnifier, let the user 'drop' at the location of the magnifier and somehow my app gets a notification that action (and location) occurred
There is possibility to use GeometryEditor which works with magnifier, but it has some requirements. More info in that thread.
I am looking at the swift SDK. And it looks like swift has events that do not exist in .net. Which would seem how Field Maps is able to handle these behaviors
Custom renderers could help you. The custom renderer approach allows you to use native controls and their features. By writing custom renderers, you can capture native touch events.
Not sure if that will give me what I need but I cannot seem to attach a handler to MapView
#if IOS
.ConfigureMauiHandlers(handlers =>
{
handlers.AddHandler<Esri.ArcGISRuntime.Maui.MapView, MyMapViewHandler>();
handlers.AddHandler<ContentPage, ContentPageHandler>();
})
#endif
I have this added in but the MyMapViewHandler never connects
public class MyMapViewHandler : Esri.ArcGISRuntime.Maui.Handlers.MapViewHandler
{
protected MapView MapView => VirtualView as MapView;
protected override void ConnectHandler(Esri.ArcGISRuntime.UI.Controls.MapView nativeView)
{
base.ConnectHandler(nativeView);
//Still do not see a long press on nativeView
}
}
> I am looking at the swift SDK. And it looks like swift has events that do not exist in .net.
The events are provided by the underlying platform views. For .MAUI that could be done via the gesture recognizers but doesn't look like they currently expose a holding event. In the maps sdk, it's actually done at the lower native level (UIKit on iOS, View on Android and FrameworkElement on Windows), and relies on the holding event to start showing the magnifier, and the pointer-up for turning it off. So you'd need to use a combo of those two events for your scenario.
oh wait I forgot we do expose the GeoViewHolding event already. You can use that to set a flag that the user is currently holding / magnifier is showing, then use the pointer-up event to drop the pin.