On my application I have a list box which displays a journey with time and location gathered from a GPS log. Next to it I draw a track on a map of the journey by generating a collection of locations for journey points and calling the AddPolyLine method to create a visible track to add to the shapes collection.
When the user clicks on any journey point in the list box I go to that point on the map so the map display is updated with where he is.
What I would like to do also is work the other way. Allow the user to click on the track and reposition the listbox display to the corresponding journey point. This is needed since the journey can consist of thousands of points and there is important other information gathered with the GPS signal.
My first thought was to use the map SelectionChange event which fires when the user first clicks on the line. From that determine the what had been selected (the line) from the GetItemType method. But that is going no where! There are no parameters in the event that I can use to determine what part of the line was clicked - the whole line is selected, not a point or a line segment.
Any ideas how I can work back to the location nearest to the point I clicked on the line?