HOW TO

Disable mouse events on Graphic features

Last Published: April 25, 2020

Summary

By default, user interface (UI) elements in a Silverlight application are able to report mouse events. This may inhibit the ability to interact with components that overlap, such as Graphics layers in the ArcGIS API for Microsoft Silverlight/WPF. In general, UI elements allow mouse events to be disabled by setting the IsHitTestVisible property to false. However, Graphics layers and Graphic components are not UI elements, so this property is not available. Instead, a custom control template can be used to configure the IsHitTestVisible property on the geometry of the symbol used to render the Graphic. Instructions provided describe how to disable mouse events on Graphic features.

Procedure

In the XAML page, modify the existing symbol markup to define a control template. In this example, a fill symbol is used:

Code:

<esriSymbols:SimpleFillSymbol x:Name="DefaultFillSymbol" Fill="#66FF0000"
BorderBrush="Red" BorderThickness="1" >
<esriSymbols:SimpleFillSymbol.ControlTemplate>
<ControlTemplate>
<Path x:Name="Element"
IsHitTestVisible="False"
Fill="{Binding Symbol.Fill}"
Stroke="{Binding Symbol.BorderBrush}"
StrokeThickness="{Binding Symbol.BorderThickness}"/>
</ControlTemplate>
</esriSymbols:SimpleFillSymbol.ControlTemplate>
</esriSymbols:SimpleFillSymbol>

Note:
The IsHitTestVisible property is set to false. Any polygon Graphic features rendered in a Graphics layer using this symbol will not respond to mouse events. This enables interaction with graphics in another layer below these polygon Graphic features.

    Article ID:000010541

    Software:
    • ArcGIS API for Silverlight Prev

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Discover more on this topic