超图 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
官方示例在\SampleCode\Constrols\ControlsInteractionWPF\ControlsInteractionWPF.csproj

posted @ 2020-03-30 21:42  Lulus  阅读(826)  评论(0编辑  收藏  举报