ArcGIS Runtime for WPF AcceleratedDisplayLayer interferers with the GraphicsLayer MouseEvents

4040
0
05-08-2015 10:28 AM
Labels (1)
EricPaitz
Esri Contributor

We noticed that none of the MouseEvents, like MouseLeftButtonDown were working for a GraphicsLayer in our WPF application and we tracked it down to the AcceleratedDisplayLayer. I created some sample code to explain.

_map = new Map();

_map.Layers.Add(new ArcGISTiledMapServiceLayer() { Url = "<insert_some_ags_url" });

MapPoint point = new MapPoint(10,10);

_graphicsLayer = new GraphicsLayer();

_graphicsLayer.Graphics.Add(new Graphic() {

    Geometry = new Envelope(point.X - 0.5, point.Y - 0.5, point.X + 0.5, point.Y + 0.5),

    Symbol = new SimpleFillSymbol() {

        Fill = Brushes.Red

    }

});

_graphicsLayer.MouseLeftButtonDown += new GraphicsLayer.MouseButtonEventHandler(graphicsLayer_MouseButtonDown);

_map.Layers.Add(_graphicsLayer);

_map.Layers.Add(new AcceleratedDisplayLayers() { ID = "ADL" });

This code above will prevent the MouseLeftButtonDown Event from firing. If we change it to the following it will work just fine.

_map.Layers.Add(new AcceleratedDisplayLayers() { ID = "ADL" });

_map.Layers.Add(_graphicsLayer);

OR

_map.Layers.Add(new AcceleratedDisplayLayers() { ID = "ADL" });

((AcceleratedDisplayLayers)_map.Layers["ADL"]).ChildLayers.Add(_graphicsLayer);

If the AcceleratedDisplayLayers is added after the GraphicsLayer (I guess its on top) seems to prevent mouse messages from passing to the GraphicsLayers underneath. If I am doing something wrong please let me know. We are using the ArcGIS Runtime for WPF 10.2.5.851.

Thanks,

   -eric

Tags (2)
0 Kudos
0 Replies