[Map 3D development practices series] Map Resource Explorer 4-WPF in Map3D Development

Source: Internet
Author: User

Directory

[Map 3D development practices series] background of Map Resource Explorer -- Kick off

[Map 3D development practices series] Map Resource Explorer 2-running and debugging

[Map 3D development practices series] Map Resource Explorer 3 -- add an AutoCAD-style Palette Interface

 

If you have already created a Map 3D custom Interface Based on WPF technology as we mentioned earlier, you may encounter a difficult problem, in the WPF editor of Visual Studio 2008, the Visual interface always displays errors, so you cannot drag the control like the Winform interface design. What's even more troublesome is that no smart prompts are available for the two xaml editors, which is really terrible for me as a WPF cainiao!

 

Each time you open a xaml file in Visual Studio 2008, the following error message is always displayed:

An Unhandled Exception has occured.

 

A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.


At System. Reflection. Module. ResolveType (Int32 metadataToken, Type [] genericTypeArguments, Type [] genericMethodArguments)
At System. reflection. customAttribute. export (export caRecord, MetadataImport scope, Assembly & Environment, Module decoratedModule, MetadataToken plugin, RuntimeType attributeFilterType, Boolean plugin, Object [] attributes, IList plugin, RuntimeType & attributeType, Role & ctor, boolean & ctorHasParameters, Boolean & isVarArg)
At System. Reflection. customattrites. GetCustomAttributes (Module decoratedModule, Int32 partition, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
At System. Reflection. customattrites. GetCustomAttributes (Assembly assembly, RuntimeType caType)
At System. Reflection. Assembly. GetCustomAttributes (Type attributeType, Boolean inherit)
At MS. Internal. Xaml. ReflectionProjectNode. BuildSubsumption ()
At MS. Internal. Xaml. ReflectionProjectNode. SubsumingNamespace (Identifier identifier)
At MS. Internal. Xaml. XmlElement. buildsscope (PrefixScope parentScope, IParseContext context)
At MS. Internal. Xaml. XmlElement. FindElementType (PrefixScope parentScope, IParseContext context)
At MS. Internal. DocumentTrees. Markup. XamlSourceDocument. get_RootType ()
At Microsoft. Windows. Design. Documents. Trees. MarkupDocumentTreeManager. get_RootType ()
At Microsoft. Windows. Design. Documents. MarkupDocumentManager. CalculateLoadErrorState ()
At Microsoft. Windows. Design. Documents. MarkupDocumentManager. get_LoadState ()
At MS. Internal. Host. PersistenceSubsystem. Load ()
At MS. Internal. Host. Designer. Load ()
At MS. Internal. Designer. VSDesigner. Load ()
At MS. Internal. Designer. VSIsolatedDesigner. VSIsolatedView. Load ()
At MS. Internal. Designer. VSIsolatedDesigner. VSIsolatedDesignerFactory. Load (IsolatedView view)
At MS. Internal. Host. Isolation. IsolatedDesigner. BootstrapProxy. LoadDesigner (IsolatedDesignerFactory, IsolatedView view)
At MS. Internal. Host. Isolation. IsolatedDesigner. BootstrapProxy. LoadDesigner (IsolatedDesignerFactory, IsolatedView view)
At MS. Internal. Host. Isolation. IsolatedDesigner. Load ()
At MS. Internal. Designer. DesignerPane. LoadDesignerView ()

Cocould not load file or assembly 'acmgd, Version = 18.1.0.0, Culture = neutral, PublicKeyToken = null' or one of its dependencies. An attempt was made to load a program with an incorrect format.


At System. ModuleHandle. ResolveType (Int32 typeToken, RuntimeTypeHandle * typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle * methodInstArgs, Int32 methodInstCount)
At System. ModuleHandle. ResolveTypeHandle (Int32 typeToken, RuntimeTypeHandle [] typeInstantiationContext, RuntimeTypeHandle [] methodInstantiationContext)
At System. Reflection. Module. ResolveType (Int32 metadataToken, Type [] genericTypeArguments, Type [] genericMethodArguments)

 

This is actually a bug in Map 3D 2011. As described in the previous article, to develop a Map 3D application, you need to add the following Map 3D references:

Map 3D related Assembly:

Autodesk. Map. Platform. dll

Autodesk. Map. Platform. Core. dll

Autodesk. Map. Platform. Utils. dll;

Autodesk. Gis. Map. Shared. dll;

OSGeo. MapGuide. Foundation. dll

OSGeo. MaoGuide. PlatformBase. dll

 

However, referencing the above Map 3D related Assembly will cause the WPF editor of Visual Studio To Work abnormally. Of course, you can use Blend, XamlPad, and other tools to edit the Xaml interface. However, for simple interface design, Blend is a little useless, and it takes a lot of time to learn this software.

 

The solution is to temporarily remove the reference of the above Map 3D assembly on the design interface, so that the WPF interface editor can work normally. After editing the interface, you need to re-Add the references of these assembly during compilation and running. The Recent tab in the reference dialog box of Visual Studio can help me quickly find the recently used assembly, which is very convenient.

 

Now, you can design your Map-based 3D application WPF interface.

 

Cheers,

Junqilian

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.