!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(); } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.