【高德地图API】Pivot控件中加载地图并禁止Pivot手势
如题,解决方案,参考【Windows phone应用开发[20]-禁止Pivot手势】http://www.cnblogs.com/chenkai/p/3408658.html。
xaml代码清单
<phone:PhoneApplicationPage
x:Class="PhoneApp2.Samples.MapPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot 是包含所有页面内容的根网格-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel 包含应用程序的名称和页标题-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="我的应用程序" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="页面名称" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - 在此处放置其他内容-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:Pivot x:Name="pivot1" Grid.Row="1" Title="pivot" >
<phone:PivotItem x:Name="pivot" CacheMode="{x:Null}" Header="item1" >
<Grid x:Name="mapLayer">
</Grid>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="item2">
<Grid x:Name="mapLayer2">
<Button Content="button" Margin="116,232,108,132"/>
<TextBlock Text="item2" Margin="150,174,124,244"/>
</Grid>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="item2">
<Grid x:Name="mapLayer3">
<Button Content="button" Margin="116,232,152,132"/>
<TextBlock Text="item2" Margin="150,174,124,244"/>
</Grid>
</phone:PivotItem>
</phone:Pivot>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
cs代码清单
AMap amap;
AMapMarker marker; //private Point currentPoint;
//private Point oldPoint; public MapPage()
{
InitializeComponent(); this.mapLayer.Children.Add(amap = new AMap());
Touch.FrameReported += (s, e) =>
{
if (e.GetPrimaryTouchPoint(amap).Action == TouchAction.Up)
{
//this.pivot1.IsLocked = false;
}
};
//amap.ManipulationStarted += (s, e) =>
// {
// this.pivot1.IsLocked = true;
// }; //amap.Loaded += amap_Loaded;
this.Loaded += MapPage_Loaded;
} void MapPage_Loaded(object sender, RoutedEventArgs e)
{
Events();
} private void Events()
{
this.pivot.UseOptimizedManipulationRouting = false;
this.pivot.AddHandler(PivotItem.ManipulationStartedEvent, new EventHandler<ManipulationStartedEventArgs>(pivot_ManipulationStarted), true);
this.pivot.AddHandler(PivotItem.ManipulationDeltaEvent, new EventHandler<ManipulationDeltaEventArgs>(pivot_ManipulationCompleted), true);
} Point startPoint;
private void pivot_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
startPoint = e.ManipulationOrigin;
} private void pivot_ManipulationCompleted(object sender, ManipulationDeltaEventArgs e)
{
Point endPoint = e.ManipulationOrigin;
if (endPoint.X - startPoint.X >= 0)
{
#region Control Right Side
e.Complete();
e.Handled = true;
#endregion
}
if (endPoint.X - startPoint.X < 0)
{
#region Control Left Side
e.Complete();
e.Handled = true;
#endregion
}
}
}
【高德地图API】Pivot控件中加载地图并禁止Pivot手势的更多相关文章
- GridView控件中加自动排列序号
GridView控件中加自动排列序号 为 Gridview 增加一个新的空白列,如下: <asp:BoundField HeaderText="序号"> < ...
- 重新想象 Windows 8.1 Store Apps (81) - 控件增强: 加载本地 html, 智能替换 html 中的 url 引用, 通过 Share Contract 分享 WebView 中的内容, 为 WebView 截图
原文:重新想象 Windows 8.1 Store Apps (81) - 控件增强: 加载本地 html, 智能替换 html 中的 url 引用, 通过 Share Contract 分享 Web ...
- easyui控件的加载顺序
使用easyui做布局时,会模仿窗口程序界面,做出一些较复杂的布局.按由外层到内层的顺序: (最外层)panel->tabs->tabs1 ->tabs2->layout-&g ...
- 使用DevExpress.XtraTabbedMdi.XtraTabbedMdiManager控件来加载MDI窗体
使用DevExpress.XtraTabbedMdi.XtraTabbedMdiManager控件来加载MDI窗体 [csharp] view plaincopyprint? <SPAN ...
- Delphi7 第三方控件1stClass4000的TfcImageBtn按钮控件动态加载jpg图片例子
Delphi7 第三方控件1stClass4000的TfcImageBtn按钮控件动态加载jpg图片例子 procedure TForm1.Button1Click(Sender: TObject); ...
- 在WinForm应用程序中,使用选项卡控件来加载不同的Form界面!
TabPage tp=new TabPage(); your选项卡控件.Controls.Add(tp); From1 frm=new Form1(); frm.TopLevel = false; f ...
- asp.net 在repeater控件中加按钮
在repeater中加入方法有两种方法: 第一种:是对repeater控件的行添加OnItemCommand事件,添加方法也是有两种 1.在设计页面中,选中repeater控件右击==>属性== ...
- WPF 修改屏幕DPI,会触发控件重新加载Unload/Load
修改屏幕DPI,会触发控件的Unloaded/Loaded 现象/重现案例 对Unloaded/Loaded的印象: FrameworkElement, 第一次加载显示时,会触发Loaded.元素被释 ...
- arcgis api for javascript本地部署加载地图
最近开始学习arcgis api for javascript,发现一头雾水,决定记录下自己的学习过程. 一.下载arcgis api for js 4.2的library和jdk,具体安装包可以去官 ...
随机推荐
- oracle关闭
Alert log 要每天查看 abort 关闭冷备会无法使用
- Codeforces985E. Pencils and Boxes (单调队列)
题意:n个数 把他们放进一些盒子里 每个盒子最少放k个数 且最小和最大的差不能大于d 题解:显然排个序 对于当前点 存一下前面有哪些节点可以当作结尾 那么就可以枚举这些点的下一个点作为起点能否和当前点 ...
- 转自王垠Blog——写给清华大学的退学申请
清华梦的粉碎—写给清华大学的退学申请(转自王垠Blog) 清华梦的诞生 小时候,妈妈给我一个梦.她指着一个大哥哥的照片对我说,这是爸爸的学生,他考上了清华大学,他是我们中学的骄傲.长大后,你也要进 ...
- Linux 应用总结:自动删除n天前的日志
linux是一个很能自动产生文件的系统,日志.邮件.备份等.虽然现在硬盘廉价,我们可以有很多硬盘空间供这些文件浪费,让系统定时清理一些不需要的文件很有一种爽快的事情.不用你去每天惦记着是否需要清理日志 ...
- Python反射、异常处理
反射 :字符串到对象属性的映射 hasattr(obj,string), 判断对象obj里面是否有叫string的字段或方法 getattr(obj,string) 获取obj对象里名叫string的 ...
- CentOS 6 Yum本地源配置
#cd /etc/yum.repos.d #rm CentOS-Base.repo CentOS-Base.repo 是yum 网络源的配置文件(默认) #vi CentOS-Media.repo C ...
- js之DOM直接操作
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- juruo的刷题&博文祭
Nothing--- 祭我bzoj过66题,博文240篇(.弱.) 自娱(愚)自乐下-
- 从“菜鸟”码农到“资深”架构师,我到底经历了什么?--------http://baijiahao.baidu.com/s?id=1585813883835208757&wfr=spider&for=pc
http://baijiahao.baidu.com/s?id=1585813883835208757&wfr=spider&for=pc
- 银河英雄传说 2002年NOI全国竞赛
时间限制: 1 s 空间限制: 256000 KB 题目等级 : 大师 Master 题目描述 Description 公元五八○一年,地球居民迁移至金牛座α第二行星,在那里发表银河联邦创立宣言,同年 ...