I have an address locator based on the ESRI sample working OK. The code is below. When it first locates the address, it zooms and pans to place the found address within the map frame but it does not center the found address. If I click the Find button again to reexecute the code, it then pans again to center the found address. I would like it to center the first time and not require a second click. I have tried placing the PanTo code in the first half of the IF statement but this seems to have no effect. Can someone tell me what I have to do to get the behavior I want?Thanks Private Sub LocatorTask_AddressToLocationsCompleted(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.AddressToLocationsEventArgs)
Dim returnedCandidates As List(Of AddressCandidate) = args.Results
Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer)
graphicsLayer.ClearGraphics()
Dim _candidateList = New List(Of AddressCandidate)()
Dim candidateListBox As New ListBox()
For Each candidate As AddressCandidate In returnedCandidates
If candidate.Score >= 95 Then
_candidateList.Add(candidate)
candidateListBox.Items.Add(candidate.Address)
Dim graphic As New Graphic() With {.Symbol = DefaultMarkerSymbol, .Geometry = candidate.Location}
graphic.Attributes.Add("Address", candidate.Address)
Dim latlon As String = String.Format("{0}, {1}", candidate.Location.X, candidate.Location.Y)
graphic.Attributes.Add("LatLon", latlon)
graphicsLayer.Graphics.Add(graphic)
End If
Next candidate
AddHandler candidateListBox.SelectionChanged, AddressOf _candidateListBox_SelectionChanged
CandidateScrollViewer.Content = candidateListBox
CandidatePanelGrid.Visibility = Visibility.Visible
Dim pt As MapPoint = _candidateList(0).Location
If _firstZoom Then
MyMap.ZoomToResolution(MyMap.Resolution / 8, pt)
_firstZoom = False
Else
MyMap.PanTo(pt)
End If
_lastIndex = 0
candidateListBox.SelectedIndex = 0
End Sub