Hi All,
I have noticed some unexpected behavior regarding the touch/stylus events that I think should be raised when using a MapOverlay with a UI control inside of the overlay. In general, if I put a button inside of a MapOverlay and attach a listener to the button's click event, the event handler is called when using a mouse, but the equivalent touch/stylus events are not raised when using a stylus or finger. Instead of raising a click event for the button, a collection of MapView events are raised, e.g. stylus down, touch down, stylus up, and so on.
I see this behavior with the 10.2.4 and 10.2.6 .NET Runtimes on a Panasonic FZ-M1 running Windows 7 and on a Dell touchscreen laptop running Windows 8.
Is this the expected behavior or a bug? Am I doing something wrong?
Thank you.
You can see this behavior by adapting the MapView_Overlays example code in the Runtime .NET SDK (Windows Desktop) Code Examples section. Below is what i did. When i click the 'CloseTooltip' button with the mouse, the expected handler is called, But when i click the button with a touch or stylus, none of the event handlers are called.
XAML
<esri:MapView.Overlays> <esri:OverlayItemsControl> <Border Margin="5" Background="#ffffffff" VerticalAlignment="Top" Width="175" BorderBrush="Black" BorderThickness="1" x:Name="MyOverlay"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="3,3,0,0" > <Grid.RowDefinitions> <RowDefinition Height="60"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="60"/> </Grid.ColumnDefinitions> <Button Grid.Column="1" Content="X" Margin="5" Name="CloseTooltip" Click="CloseTooltip_Click"></Button> <TextBlock Grid.Column="0" Text="{Binding [areaname]}" FontWeight="Bold" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center"/> </Grid> </Border> </esri:OverlayItemsControl> </esri:MapView.Overlays>
C#
private void CloseTooltip_Click(object sender, RoutedEventArgs e) { AddToEventsList("CLOSE Tooltip button clicked with MOUSE."); ClearMapOverlays(); } private void CloseTooltip_Click(object sender, StylusButtonEventArgs e) { AddToEventsList("CLOSE Tooltip button clicked with STYLUS."); ClearMapOverlays(); } private void CloseTooltip_Click(object sender, TouchEventArgs e) { AddToEventsList("CLOSE Tooltip button clicked with TOUCH."); ClearMapOverlays(); } private void CloseTooltip_Click(object sender, MapViewInputEventArgs e) { AddToEventsList("CLOSE Tooltip button clicked with Map View Events."); ClearMapOverlays(); } private void ClearMapOverlays() { MapView.SetViewOverlayAnchor(MyOverlay, null); _FeatureLayer.ClearSelection(); }
Solved! Go to Solution.
Keeping with the time honored traditions, i stumbled upon the answer to my question about 15 minutes after posting.
I was missing the 'StylusButtonDown' event. As soon as i added that event to button's code, the behavior was as expected.
Keeping with the time honored traditions, i stumbled upon the answer to my question about 15 minutes after posting.
I was missing the 'StylusButtonDown' event. As soon as i added that event to button's code, the behavior was as expected.