hi all, i've got a user control (code attached) that was working just fine in the pre-RC of the API (it is in fact almost entirely built on the sample here http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Navigation), but now will throw an error when following these steps after starting the app:1) pressing the zoom in tool2) using the zoom in tool to zoom in3) pressing the pan tool4) pressing the zoom in tool again.and will occur at the highlighted line in the sub below Private Sub ToolButton_Clicked(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
If _bDrawObjectInitialized = False Then
_DrawObject = New Draw(Map) With {.DrawMode = DrawMode.Rectangle, .FillSymbol = DefaultFillSymbol}
AddHandler _DrawObject.DrawComplete, AddressOf _DrawObject_DrawComplete
_bDrawObjectInitialized = True
End If
Dim Btn As Button = sender
For Each childBtn As Button In ToolsPanel.Children
If childBtn.Name <> Btn.Name Then
childBtn.Background = _OriginalButtonBackground
End If
Next
Btn.Background = ToggleGradient 'New SolidColorBrush(Color.FromArgb(128, 0, 255, 0))
Dim ToolName As String = Btn.Name
Select Case ToolName
Case "Pan"
_DrawObject.IsEnabled = False
DrawActive = False
_toolmode = "pan"
Case "ZoomInTool"
_DrawObject.IsEnabled = True
DrawActive = True
_toolmode = "zoomin"
Case "ZoomOutTool"
_DrawObject.IsEnabled = True
DrawActive = True
_toolmode = "zoomout"
End Select
End Sub
the short version of the error isObject reference not set to an instance of an object.
and the long one is{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.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 CHFMap09.NavBar.ToolButton_Clicked(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)}