Select to view content in your preferred language

What's the best way to symbolize a point as selected/unselected in a featurelayer?

645
1
10-04-2010 11:55 AM
WilliamCharles
New Contributor
Hi All,

I am having trouble understanding how best to remove the default (cyan) selection symbol after selecting the next feature from an ArcGISDynamicMapServiceLayer's featurelayer. When I select a point feature it turns cyan (good), but when I select another different point feature then the previous one stays cyan as if it's still selected, though it's not, ad. infinitum. I've looked at the samples and perused the API and nothing jumps out at me. I think I have a basic conceptual difficulty with the concept of rendering.

I haven't defined any graphics layers, just a point feature layer. Apparently by default, the selected feature turns cyan when selected. Okay. Well, then do I need to define a renderer? For unselected point features? How do I do that? Or do I need to define a Graphicslayer and explicitly define renderers for selected/unselected? And how do I turn off the default featurelayer rendering of the selected feature?

I'm confused. Thanks in advance for any help,

WC ...
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
I think you are referring to one of the bugs we fixed for 2.1. But just to clarify, are you using Editor or EditorWidget to make your selection? What Mode is your layer set? When you make your selection and it fails to unselect features, could it be because no new selection is made on that specific layer?

To answer your question though -there are several events you can tap into to find out if new features are selected (i.e. layer's PropertyChanged event where e.PropertyName == "SelectedGraphics" or "SelectionCount", editor's EditCompleted event where e.Action == Editor.EditAction.Select).

At any point, you can iterate through the Graphics to verify that the graphic's Selected property is set to true/false. If you need to unselect the graphic, you can do either: graphic.Selected = false or graphic.UnSelect(). There is no need to change the Renderer for this purpose. Setting SelectionColor property on the layer only dictates how the feature will be displayed when selected.

It would be great if you can give us more information on how to reproduce the issue so we can determine if this is the bug we fixed or if it is separate. Let us know the steps you've taken when you find that features are supposed to be deselected but they are not.

Thank you.
0 Kudos