超图 wpf地图控件加载地图

引用

System.Windows.Forms
WindowsFormsIntegration
SuperMap.Mapping

使用

前端xaml

<Window xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration">
	<wfi:WindowsFormsHost x:Name="hostMapControl"></wfi:WindowsFormsHost>
</Window>

后端代码加载Map

private Workspace showMapWorkspace;
private MapControl showMapControl;

showMapWorkspace = new Workspace();
showMapWorkspace.Open(new WorkspaceConnectionInfo(@"path.smwu"));

showMapControl = new MapControl();
showMapControl.Action = SuperMap.UI.Action.Pan;
//必须设置
showMapControl.Map.Workspace = showMapWorkspace;
showMapControl.Map.Open(showMapWorkspace.Maps[0]);

//赋值给前端控件hostMapControl
hostMapControl.Child = showMapControl;

示例代码

LoadMap
官方示例在SampleCodeConstrolsControlsInteractionWPFControlsInteractionWPF.csproj

原文地址:https://www.cnblogs.com/Lulus/p/12601469.html