AnsweredAssumed Answered

ArcGIS Runtime for WPF AcceleratedDisplayLayer interferers with the GraphicsLayer MouseEvents

Question asked by epaitz-esristaff Employee on May 8, 2015

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

Outcomes