Hi,
I experienced a problem with multiple times MouseLeftButtonDown on the same graphicsLayer, now I figured out how to avoid this problem, but I hope I could get better idea how to handle the issue.
My problem is like the following:
#1. I have an application with two user controls called userControl1, usercontrol2, a graphicsLayer called gLayer
#2. In the MainPage, int the UserControl_Loaded function like this :
control1 = new userControl1( map, gLayer);
control2 = new usercontrol2(map, gLayer);
in the userControl1 code, have some processes like : gLayer.graphics.Clear() -> gLayer.Graphics.Add(graphic) -> gLayer.MouseLeftButtonDown +=new GraphicsLayer.MouseButtonEventHandler ( gLayer_MouseLeftButtonDown1), then do something
in the usercontrol2 code have processes like : gLayer.graphics.Clear() -> gLayer.Graphics.Add(graphic) -> gLayer.MouseLeftButtonDown +=new GraphicsLayer.MouseButtonEventHandler ( gLayer_MouseLeftButtonDown2), then do something else.
#3. When I stated the application, with user controls1, it would be OK, but with usercontrol2, when mouseLeftButtondown on gLayer, I got the error : Required parameter is null or empty. Parameter name : graphics
#4. If in the UserControl_Loaded function of the MainPage, put control2 over control1, then the error would come with control1, control2 would be OK.
#5, When I used 2 graphicslayers for control1 and control2 respectively, it would be OK. Since in my application, I have many controls need to call the same graphicslayer and click on the same layer, I hope I could find a better way.
Thanks in advance for your help.