Dominique, know this is an old thread, are you still around ?
I have a checkbox SHOW ALL LAYERS that sets ShowOnlyVisibleLayers to false...The legend is created SYNCRONOUSLY and user cannot do anything while it is being generated.
//listens for layer added to legend but not removed base.Refreshed += new EventHandler<RefreshedEventArgs>(BinLegend_Refreshed); //listens for layer removed from layer id collection DependencyPropertyUtilities.RegisterForNotification("LayerIDs", this, LayerIDsChanged);
None of the notification mechanisms from Legend (Refresh event, LayerItems, LayerItemsSource property changed) do exactly what I want. I'm looking for a way to be notified when I 1)add a layer and 2) remove a layer.
The problem with LayerItems dependency property is it's not updated consistently enough (I know that's vague but it's been a couple weeks since I looked at it).
The problem with LayerItemsSource dependency property is it's updated too often.
I believe that the Refresh event would be ideal for me to listen to if it were fired when a layer was removed from the map. Can you consider adding this?
Next question. You gave an excellent explanation of 3 of the classes. They make sense. I'm still confused about the 2 biggie properties on the Legend control, Legend.LayerItems versus Legend.LayerItemsSource. I'm using the control in a flat fashion (no tree structure). In that case, is Legend.LayerItems identical to Legend.LayerItemsSource?
What is the purpose of composing your Legend control with that LegendTree class?
This happens:after adding a layer: as soon as the legend is available (we get the legend asynchronously).when the legend of the map layer has changed (e.g. if the renderer of a feature layer changes).when someone calls 'Refresh
It doesn't fire for all additions or removals of a map layer or change in layerID list. I reverted then to registering for notification of when the Legend's LayerItemsSource dependency property changes which isn't ideal.
I recognize that this is a long post and am hoping to just start some dialog with one of the developers of this control.
The text that you have entered is too long (13167 characters). Please shorten it to 10000 characters long.
I'd like to organize items (layer items) in the legend control into headings, for example SL headered items or accordion items.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.