Hello,I am upgrading an web application from the v1.2 API to v2.0.In addition we have moved to Silverlight 4, .Net 4.0, and Visual Studio 2010.After having completed the reference updates and other necesarry improvements to our development environment, I am left with one nagging problem. The feature Layers will not instantiate. They are declared in XAML and I set the symbols in the code behind as well as set the outfields. I receive an error at runtime that the feature layer is not set to an instance of an object.I have created an Initialization Failed event listener and the error message is simply:"Server Error - Object not set to an instance of an object."I have one dynamic service map layer and four feature layers.The dynamic service layer displays fine, as does the FIRST feature layer. But the other three are not displaying, throwing this error. I have checked my map services, and checked the end points through rest. I have even recreated the services in ArcGIS Server 10 and have the same problem.I've also noticed that you cannot change the URL of a FeatureLayer at runtime? Is this correct?Below is my XAML, you can see I set maptips and outfields for the first layer to use native maptips. For the other layers I have custom maptips that I set in code behind.
<esri:Map x:Name="FloorplanSpatial"
Extent="1354190, 556290, 1354335, 556410"
Width="495"
Height="490"
IsLogoVisible="False">
<esri:Map.Layers>
<esri:ArcGISDynamicMapServiceLayer ID="ElectricFeatures"
Url="http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/"
DisableClientCaching="True"
ImageFormat="JPG" />
<esri:FeatureLayer ID="BreakerBoxControls"
MouseLeftButtonDown="BreakerBoxControls_MouseLeftButtonDown"
Url="http://http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer//1">
<esri:FeatureLayer.OutFields>
<sys:String>PANELNAME</sys:String>
</esri:FeatureLayer.OutFields>
<esri:FeatureLayer.MapTip>
<Grid Margin="0,15,15,0">
<Rectangle RadiusX="5"
RadiusY="5"
Fill="LightGray"
Margin="0,4,0,0" />
<Rectangle Stroke="Gray"
RadiusX="5"
RadiusY="5"
Fill="#775C90B2"
Margin="0,0,0,5" />
<Rectangle Fill="#FFFFFFFF"
Stroke="DarkGray"
RadiusX="5"
RadiusY="5"
Margin="10,10,10,15" />
<StackPanel Margin="5,5,5,5"
Background="White">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Panel: "
Margin="3,0,3,0" />
<TextBlock Text="{Binding [PANELNAME]}"
FontWeight="Bold" />
</StackPanel>
</StackPanel>
</Grid>
</esri:FeatureLayer.MapTip>
</esri:FeatureLayer>
<esri:FeatureLayer ID="HVACcontrols"
Url="http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/6"
Visible="True" InitializationFailed="FeatureLayer_InitializationFailed">
</esri:FeatureLayer>
<esri:FeatureLayer ID="HVAC_VAVboxes" Url="http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/7"
Visible="True" InitializationFailed="FeatureLayer_InitializationFailed">
</esri:FeatureLayer>
<esri:FeatureLayer ID="HVAC_RTU"
Url="http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/26"
Visible="False" InitializationFailed="FeatureLayer_InitializationFailed">
</esri:FeatureLayer>
</esri:Map.Layers>
</esri:Map>
Here is my code behind. It fails at the .Update() function. If I comment that out, I still get an Unhandled Silverlight error.
Dim dynamicServiceLayer As ArcGISDynamicMapServiceLayer = TryCast(FloorplanSpatial.Layers("ElectricFeatures"), ArcGISDynamicMapServiceLayer)
dynamicServiceLayer.VisibleLayers = HVACTabFloor2Collection
Dim HVACcontrolsLayer As FeatureLayer = TryCast(FloorplanSpatial.Layers("HVACcontrols"), FeatureLayer)
Dim HVACcontrolsSymbol As SimpleMarkerSymbol = New SimpleMarkerSymbol
HVACcontrolsSymbol.Color = New SolidColorBrush(Color.FromArgb(20, 0, 0, 0))
HVACcontrolsSymbol.Style = SimpleMarkerSymbol.SimpleMarkerStyle.Circle
HVACcontrolsSymbol.Size = 8
HVACcontrolsLayer.FeatureSymbol = HVACcontrolsSymbol
HVACcontrolsLayer.Url = "http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/6"
HVACcontrolsLayer.Update()
HVACcontrolsLayer.OutFields.Add("THERMNAME")
HVACcontrolsLayer.OutFields.Add("USERDOC")
HVACcontrolsLayer.OutFields.Add("DWG")
'HVACcontrolsMapTip.GraphicsLayer = HVACcontrolsLayer
Dim HVACVAVboxesLayer As FeatureLayer = TryCast(FloorplanSpatial.Layers("HVAC_VAVboxes"), FeatureLayer)
Dim HVACVAVboxesSymbol As SimpleMarkerSymbol = New SimpleMarkerSymbol
HVACVAVboxesSymbol.Color = New SolidColorBrush(Color.FromArgb(20, 0, 0, 0))
HVACVAVboxesSymbol.Style = SimpleMarkerSymbol.SimpleMarkerStyle.Square
HVACVAVboxesSymbol.Size = 10
HVACVAVboxesLayer.FeatureSymbol = HVACVAVboxesSymbol
'HVACVAVboxesLayer.Url = "http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/7"
'HVACVAVboxesLayer.Update()
HVACVAVboxesLayer.OutFields.Add("NAME")
HVACVAVboxesLayer.OutFields.Add("USERDOC")
HVACVAVboxesLayer.OutFields.Add("DWG")
'VAVboxesMapTip.GraphicsLayer = HVACVAVboxesLayer
Dim HVACRTUlayer As FeatureLayer = TryCast(FloorplanSpatial.Layers("HVAC_RTU"), FeatureLayer)
Dim HVACRTUsymbol As SimpleMarkerSymbol = New SimpleMarkerSymbol
HVACRTUsymbol.Color = New SolidColorBrush(Color.FromArgb(255, 0, 0, 255))
HVACRTUsymbol.Style = SimpleMarkerSymbol.SimpleMarkerStyle.Square
HVACRTUsymbol.Size = 15
HVACRTUlayer.FeatureSymbol = HVACRTUsymbol
'HVACRTUlayer.Url = "http://myserver.com/ArcGIS/rest/services/ServiceName/MapServer/26"
'HVACRTUlayer.Update()
HVACRTUlayer.OutFields.Add("NAME")
HVACRTUlayer.OutFields.Add("USERDOC")
'RTUMapTip.GraphicsLayer = HVACRTUlayer
Dim CircuitPanelLayer As FeatureLayer = TryCast(FloorplanSpatial.Layers("BreakerBoxControls"), FeatureLayer)
Dim circuitPanelSymbol As New SimpleMarkerSymbol
circuitPanelSymbol.Color = New SolidColorBrush(Color.FromArgb(10, 0, 0, 0))
circuitPanelSymbol.Style = SimpleMarkerSymbol.SimpleMarkerStyle.Circle
circuitPanelSymbol.Size = 10
CircuitPanelLayer.FeatureSymbol = circuitPanelSymbol
Any suggestions are appreciated. Thanks.