原文:[Windows Phone] 实作不同的地图显示模式

前言

本文章主要示范如何让地图有不同的模式产生,例如平面图、地形图、鸟瞰图、鸟瞰图含街道等。

这部分主要是调整 Map.CartographicMode 属性,其中 MapCartographicMode 列举包含:

  • Road:Specifies the road mode of the map control.
  • Aerial:Specifies the aerial mode of the map control.
  • Hybrid:Specifies an aerial mode with overlaid roads and labels.
  • Terrain:Specifies the terrain mode of the map control.

?

实作

step1 建立专案。

?

step2 在 WMAppManifest.xml 的地方用滑鼠点两下进行编辑。

?

step4 进去 WMAppManifest.xml 後,先点选 [功能],再勾选 [ID_CAP_MAP] 来开启地图功能。

?

step5 MainPage.xaml 画面设计。

Button1 ---->Name=btn1,Content=平面图

Button2 ---->Name=btn2,Content=地形图

Button3 ---->Name=btn3,Content=鸟瞰图

Button4 ---->Name=btn4,Content=鸟瞰图含街道

map ------>Name=map,Center="24.15,120.43"为台中市经纬度,ZoomLevel="10"为缩放比例

?

产生 xaml 程式码:

 xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="10,0,14,0">
<Button x:Name="btn1" Content="平面图" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Click="btn1_Click"/>
<Button x:Name="btn2" Content="地形图" HorizontalAlignment="Left" Margin="150,10,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.051,0.477" Click="btn2_Click"/>
<Button x:Name="btn3" Content="鸟瞰图" HorizontalAlignment="Left" Margin="297,10,0,0" VerticalAlignment="Top" Click="btn3_Click"/>
<Button x:Name="btn4" Content="鸟瞰图含街道" HorizontalAlignment="Left" Margin="86,82,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.923,0.746" Click="btn4_Click" Width="287"/> <maps:Map x:Name="map" Center=" 24.15,120.43" ZoomLevel=" 10" HorizontalAlignment="Left" Margin="10,172,0,0" VerticalAlignment="Top" Height="423" Width="436"/> </Grid>

?

step5? MainPage.xaml.cs 程式码中的事件处理函式如下:

 private void btn1_Click(object sender, RoutedEventArgs e)
{
map.CartographicMode = MapCartographicMode.Road;//Road为显示平面图
} private void btn2_Click(object sender, RoutedEventArgs e)
{
map.CartographicMode = MapCartographicMode.Terrain; //Terrain为显示地形图
} private void btn3_Click(object sender, RoutedEventArgs e)
{
map.CartographicMode = MapCartographicMode.Aerial; //Aerial为显示鸟瞰图
} private void btn4_Click(object sender, RoutedEventArgs e)
{
map.CartographicMode = MapCartographicMode.Hybrid; //Hybrid为显示鸟瞰图含有街道
}

结果

平面图 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 地形图

?? ? ? ? ??

鸟瞰图 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?鸟瞰图含街道

? ? ? ? ? ?

?

范例下载

map 地图模式.rar

?

相关参考与引用

Map.CartographicMode 属性

?

?

posted on 2013/11/25 17:37 |
阅读数 : 264
|

1 人推荐

我要推荐

|
Add Comment

| 文章分类 [

Windows Phone

]

|
订阅

[Windows Phone] 实作不同的地图显示模式的更多相关文章

  1. Windows 10 新特性 -- Bing Maps 3D地图开发入门(一)

    本文主要内容是讲述如何创建基于 Windows Universal App 的Windows 10 3D地图应用,涉及的Windows 10新特性包括 Bing Maps 控件.Compiled da ...

  2. 如何添加地图控件到Windows Phone 8的页面中

    原文 如何添加地图控件到Windows Phone 8的页面中 本主题介绍了各种方法来添加一个地图控件到Windows Phone 8的项目.该地图控件在Windows Phone的SDK 8.0的库 ...

  3. Silverlight for Windows Phone开发系列课程

    Silverlight for Windows Phone开发系列课程(1):Windows Phone平台概况         课程简介:本节开始介绍系列课程的概况,包括课程内容,先决条件,学习目的 ...

  4. WP8关于对地图开发的改进

    原文:WP8关于对地图开发的改进 微软在2012年6月21日 发布了 Windows Phone 8的更新.带来大量的功能更新和全新的SDK.作为重头戏的部分是引入了 C++ 和 DirectX,支持 ...

  5. Windows中的键盘快捷方式大全

    Windows有很多键盘快捷方式,使用键盘快捷方式能够大大提高使用windows的效率,同时还能提升自己的逼格,背熟几个快捷方式,操作起来行云流水犹如大神一般! 页面较长,请使用目录浏览(点击跳转), ...

  6. Windows中的键盘快捷方式

    Windows 中的键盘快捷方式 适用于: Windows 10Windows 8.1Windows 7 Windows 10 键盘快捷方式就是按键或按键组合,可提供一种替代方式来执行通常使用鼠标执行 ...

  7. Windows快捷键大全

    每天在使用电脑,不会记点快捷键怎行?高效办公从快捷键开始! Windows 10 键盘快捷方式就是按键或按键组合,可提供一种替代方式来执行通常使用鼠标执行的操作. 其他键盘快捷方式 应用中的键盘快捷方 ...

  8. Windows电脑常用快捷键

    Windows 徽标键键盘快捷方式: Windows 徽标键      打开或关闭“开始”屏幕 Windows 徽标键  + A       打开操作中心 Windows 徽标键  + B       ...

  9. 快捷键(一):Win10

    Ctrl + X 剪切选定项 Ctrl + C(或 Ctrl + Insert) 复制选定项 Ctrl + V(或 Shift + Insert) 粘贴选定项 Ctrl + Z 撤消操作 Alt + ...

随机推荐

  1. Mysql自增主键ID重新排序方法详解

    Mysql数据库表的自增主键ID号乱了,需要重新排列. 原理:删除原有的自增ID,重新建立新的自增ID. 1,删除原有主键: ALTER TABLE `table_name` DROP `id`; 2 ...

  2. visual studio 2012 使用 git/github

    Visual studio 2012 除了支持自己的TFS还支持Git,这里讲的原生的支持,相比让VS2010支持Git要简单的多,仅仅需要两步: 第一步 安装工具: Microsoft.TeamFo ...

  3. 执行Asp.net应用程序在Linux上的3种托管方式

    执行Asp.net应用程序在Linux上的3种托管方式 想要执行Asp.net应用程序在Linux上.我们有3种选择: 1.使用Apache作为Webserver.使用mod_mono:http:// ...

  4. [SVN]创建本地的SVN仓库

    本地创建SVN仓库,就算是自己平时写代码也养成使用SVN的习惯. 环境: OS:Mac OS X10.9.1 SVN Version:1.7.10 创建本地SVN仓库: $svnadmin creat ...

  5. C++中的#pragma 预处理指令详解

    源地址:http://blog.csdn.net/roger_77/article/details/660311 在所有的预处理指令中,#pragma 指令可能是最复杂的了,它的作用是设定编译器的状态 ...

  6. jQuery中常用的函数方法

    jQuery中常用的函数方法总结 Ajax处理 load(url,[data],[callback]) url (String) : 待装入 HTML 网页网址. data (Map) : (可选) ...

  7. www.centos.org

    https://www.centos.org/forums/viewtopic.php?t=5770 In order to conserve the limited bandwidth availa ...

  8. A Game of Thrones(9) - Tyrion

    Somewhere in the great stone maze(迷宫:迷惑) of Winterfell, a wolf howled. The sound hung over the castl ...

  9. hdu1992(递推)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1992 题意:用1*2和2*1的小长方形铺垫4*W的方格有多少种方法. 分析:假如新加入1列,这列都竖着 ...

  10. 画师绘制《进击的巨人》电影版海报 堪比好莱坞- Micro Reading

    http://m.baidu.com/from=844b/bd_page_type=1/ssid=0/uid=3151E6C0905477A13653132D762BB6FB/pu=sz%401320 ...