!string.IsNullOrEmpty(layer.ID)
public void Layers_CollectionChanged(Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { //this event if fired when this code is executed: MyDrawObject.DrawMode = DrawMode.... //so we look for single layers being added/removed with null Ids //we supress the refresh in these circumstances bool DontFire = false; if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { if (e.NewItems != null && e.NewItems.Count == 1) { if (((ESRI.ArcGIS.Client.Layer)e.NewItems[0]).ID == null) { DontFire = true; } } } else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) { if (e.OldItems != null && e.OldItems.Count == 1) { if (((ESRI.ArcGIS.Client.Layer)e.OldItems[0]).ID == null) { DontFire = true; } } } if (DontFire == false) { Refresh(); } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.