Hello,
I've a property grid that I want to show the common attributes for the selected elements in the map. I've seen two different ways to do it:
1) Attaching a method to the OnEditCompleted() event in the ESRI.ArcGIS.Client.Editor class. So I can check that the user just finish selecting the elements and I can take the SelectedGraphics collection.
2) Using the SelectedGraphics property in the GraphicsLayer class. In fact, I can't use directly. You have exposed the property as a IEnumerable<Graphic> altough the private field that is returned is an ObservableCollection<Graphic> (why not exposing it directly as a observable collection?). So I cast this property to it's original value and attach a method to the CollectionChanged event. This allows me to know when an element has been selected (or deselected).
Ok, but each method has its share of problems:
#1) That works ok. But what if I can select from other places, like from a tree view with all elements? This tree view, for example, has nothing to do with the Editor (directly). I'll change the Selected property for the element (graphic) but this event wont be fired (expected).
#2) If I select 100 elements, the CollectionChanged event will be fired 100 times. No matter what I do, it becames slow.
So, what I need is a generic way (event?) to know when the user has just finish selecting elements. Be it 100 elements or just one, I would attach a method to an event and be notified just one time.
Am I missing something? Do we have some way to do it today?
Thank you!
André