How can I detect if user has clicked on a polyline that has been added to the map? I have tried the following, but the new mouse event does not fire when the user clicks on the polyline on the map:
pline.AddHandler(MouseLeftButtonDownEvent, New MouseButtonEventHandler(AddressOf pline_MouseLeftButtonDown))
6 Answers, 1 is accepted
It is not clear from your post what type of layer (InformationLayer or VisualizationLayer) you are using. But looking into your code I supposed that it is the InformationLayer. The problem is that you assign an event handler after you add a line to the information layer. Because of the nature of the map shape objects it must be done before you add a line to the information layer. The following code works as expected so please give it a try on your side as well:
Let us know if we can further assist you.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
we have created a own Polyline object which inherits from the MapPolyline. Now we like get the coordinate where the user has clicked the polyline.
We like to create a polyline where a user could take the polyline and start moving it. Like a route in google maps where a user will add a new station.
Do you have any solution or idea? Is the polyline the right object?
First of all, we don't recommend to inherit from the map shape objects classes (MapPolyline, for example), because it can have unpredictable result and brake functionality of the InformationLayer.
As for the polyline moving, it is not clear from you message how you suppose to move the polyline (the whole polyline or just one point of the polyline). Anyway, I would recommend you to take a look into the following resources:
I hope it could help.
I know the examples and have test them but in my scenario it´s a little bit other.
You know google maps, if you have created a route then you will see the polyline of the route in the map. Now you could click everywhere on the polyline and drag the way to another place. (See startdrag.png and drop.png)
Now we will create a control which could show in the map and get a notification if a user clicks the line (start and destination of the line are knowing) and starting drag&drop. If he drops the point we will start a operation.
Hope that this informations are helpful and you could get me some more tips.
Unfortunately the RadMap does not contain built-in functionality which can serve your scenario. You can get geographical coordinates of the clicked point in the MouseLeftButtonDown event using following code:
But it is on your own to find the polyline segment this point belongs to, add new point and perform drag'n'drop operations on it.