Select to view content in your preferred language

New runtime error with Navigation and Legend in Silverlight 5

2506
1
01-09-2012 02:16 AM
PavelMoiseets
New Contributor
I have a working project with Map, Legend and Navigation objects. After changing project type from Silverlight 4 to 5 it still compiles. But I get a runtime error at InitializeComponent() in the Constructor.

System.Windows.Markup.XamlParseException occurred
  Message=Set property 'System.Windows.FrameworkElement.Style' threw an exception. [Line: 91 Position: 85]
  LineNumber=91
  LinePosition=85
  StackTrace:
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at ***.ArcGisMap.View_ArcGisMap.InitializeComponent()
       at ***.ArcGisMap.View_ArcGisMap..ctor()
  InnerException: System.Windows.Markup.XamlParseException
       Message=Failed to create a 'System.Type' from the text 'local:FeatureDataGrid'. [Line: 13 Position: 36]
       LineNumber=13
       LinePosition=36
       StackTrace:
            at MS.Internal.XcpImports.CreateFromXaml(UnmanagedMemoryStream stream, String sourceAssemblyName, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers, String xamlResourceUriString, Boolean isBinaryContent)
            at System.Windows.Controls.Control.GetBuiltInStyle(IntPtr nativeTarget, IntPtr& nativeStyle)

The expception goes away if I recompile and run as Silverlight 4. Or get rid of both Navigation and Legend.

That is, I tried and, having something as simple as

    <Canvas x:Name='MainCanvas' Width="800" Height="600" >
        <esri:Map x:Name="MyMap" Background="White" Canvas.Left="5" Canvas.Top="5" WrapAround="True" Height="590" Width="790">
            <esri:LayerCollection xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
                <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
            </esri:LayerCollection>
        </esri:Map>
        <esri:Navigation x:Name="Navigation"  Canvas.Left="15" Canvas.Top="460" Map="{Binding ElementName=MyMap}" />
    </Canvas>

with this project, gives me this error. While the same Canvas without Navigation works. All library references point to dlls version 2.3.0.774

I would very much like to know what could be the cause of this and how to fix it.
0 Kudos
1 Reply
ChristopherHill
Deactivated User
try adding the following assemblies to your project and then building.

System.Windows.Controls.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
0 Kudos