Hi,
I have a Draw object for simple drawing on the map and a Button for enabling it:
ctrlDrawItem.IsEnabled = true;
Sometimes it works as expected but sometimes fails:
{System.NullReferenceException: Object reference not set to an instance of an object.
at ESRI.ArcGIS.Client.LayerCanvas.PrepareAnimation()
at ESRI.ArcGIS.Client.Map.beginZoomToExtent(Envelope targetExtent, Boolean skipAnimation)
at ESRI.ArcGIS.Client.Map.zoomToResolution(Double resolution, MapPoint center, Boolean skipAnimation)
at ESRI.ArcGIS.Client.Map.ZoomToResolution(Double resolution, MapPoint center)
at ESRI.ArcGIS.Client.Map.ZoomToResolution(Double resolution)
at ESRI.ArcGIS.Client.Map.Layers_LayersInitialized(Object sender, EventArgs args)
at ESRI.ArcGIS.Client.LayerCollection.LayersInitializedHandler.Invoke(Object sender, EventArgs args)
at ESRI.ArcGIS.Client.LayerCollection.calculateLevelScheme()
at ESRI.ArcGIS.Client.LayerCollection.LayerCollection_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
at System.Collections.ObjectModel.Collection`1.Add(T item)
at ESRI.ArcGIS.Client.Draw.Activate()
at ESRI.ArcGIS.Client.Draw.OnIsEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at ESRI.ArcGIS.Client.Draw.set_IsEnabled(Boolean value)
at ViewPage.EditGeometry()
at ViewPageXAML.cmdEditGeometry_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)}
Still can't find any workarounds, just restarting the app and hopping that it will work this time.
Using SL 2.0 RC. Any ideas?