hi all,ive got two symbols and two graphics layers defined in xaml as such:
<Grid.Resources>
<esriSymbols:SimpleMarkerSymbol x:Name="DefaultMarkerSymbol" Size="8" Color="#DD00FFFF"/>
<esriSymbols:SimpleMarkerSymbol x:Name="HighlightMarkerSymbol" Size="10" Color="#DDFF0000"/>
</Grid.Resources>
<esri:Map x:Name="Map">
<esri:Map.Layers>
<esri:GraphicsLayer ID="FindLayer" Visible="False" />
<esri:GraphicsLayer ID="HighlightLayer" Visible="False"/>
</esri:Map.Layers>
</esri:Map>
The "FindLayer" shows all of the results returned from a Find task and displays the "DefaultMarkerSymbol" for each result returned fine.
'Called when the FindTask Task is completed and contains valid results
Private Sub ShowResultsOnMap(ByVal results As List(Of FindResult))
Dim findLayer As GraphicsLayer = TryCast(Map.Layers("FindLayer"), GraphicsLayer)
Dim graphicsList As New List(Of Graphic)
For Each fr As FindResult In results
graphicsList.Add(fr.Feature)
Next
For Each foundFeature As Graphic In graphicsList
foundFeature.Symbol = DefaultMarkerSymbol 'Defined in XAML
findLayer.Graphics.Add(foundFeature)
Next
findLayer.Visible = True
End Sub
When selecting a result from the listbox that the attributes are displayed in, the "HighlightLayer" shows the larger, "HighlightMarkerSymbol" on top. It works fine for the first selection, but for some reason each subsequent selection simply highlights the selection without removing the previous one. it's like the "ClearGraphics" method doesn't work....but it does. the collection is clear, but the symbol seems to persist on the "HighlightLayer" graphics layer. this will happen for each subsequent selection. Private Sub lbFoundFeatures_SelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs)
Dim highlightLayer As GraphicsLayer = TryCast(Map.Layers("HighlightLayer"), GraphicsLayer)
highlightLayer.ClearGraphics()
Try
Dim selectedListBoxItem As ESRI.ArcGIS.Client.Tasks.FindResult = TryCast(e.AddedItems(0), ESRI.ArcGIS.Client.Tasks.FindResult)
Dim selectedFeature As Graphic = selectedListBoxItem.Feature
selectedFeature.Symbol = HighlightMarkerSymbol 'Defined in XAML
highlightLayer.Visible = True
highlightLayer.Graphics.Add(selectedFeature)
Catch ex As Exception
'Cathes error when e.AddItems is Nothing
End Try
End Sub
Oddly, if i never call the ShowResultsOnMap sub (so that the results are not highlighted in cyan upon the FindTask completion), then the highlighting works fine; when a result is selected in the listbox, the corresponding red dot appears on the map. selecting a different result removes the previous and shows the newly selected one.does anyone know what's going on?lance