Stylus.IsPressAndHoldEnabled does not generate Right-Click on MapView.

862
0
09-12-2021 06:15 PM
GBCodeByter
New Contributor

Ladies and Gentlemen,
I am looking for a solution to the following scenario regarding Touch Gestures on a Map View to generate a "Right-Click" mouse event...

I am using ArcGISRuntime100.5 to create a User Control in WPF. This control has been under development for a couple of years now but was initially designed to only use mouse input instead of touch gestures. I am now attempting to implement said gestures but am having a problem getting a "Touch and Hold" gesture to generate a "Right-Click". The MapView already has built-in functionality for a "Right-Click" mouse event which is mapped to the OnContextMenuOpening event. However, setting the Stylus.IsPressAndHoldEnabled property to True, within code or in the MapView UI XAML, always results in a "Magnifying Glass" being displayed on "Touch and Hold" and never generates a "Right-Click" to open the Context Menu. I am assumming this "Magnifying Glass" functionality is also built into the MapView, but I cannot seem to override it using the suggested Stylus methods.

XAML:
<esri:MapView x:Name="ArcGISMapView" Map="{Binding Map}" Grid.Row="0" Grid.Column="{Binding ToggleColumn}" Grid.ColumnSpan="2" ContextMenu="{StaticResource MapContextMenu}"
Panel.ZIndex="0" Stylus.IsPressAndHoldEnabled="True">

Code:
// Testing Touch Events...
// Trying to get Touch and Hold to generate Right-Click so Context menu will appear!!
m_MapView.TouchDown += new EventHandler<TouchEventArgs>(HandleTouchDown);
m_MapView.TouchUp += new EventHandler<TouchEventArgs>(HandleTouchup);
Stylus.SetIsPressAndHoldEnabled(this.m_MapView, true);

I would be very grateful for any assistance!!
Thank you,
GBCodeByter

0 Kudos
0 Replies