【高德地图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,具体安装包可以去官 ...
随机推荐
- linux命令整理版(拷贝)
一.文件和目录操作命令 1.pwd 显示当前所在位置 -L 显示逻辑路径,忽略软链接文件 -P 显示物理路径时如果当前目录路径时软链接文件,则会显示软链接对应的源文件 2.cd 切换目录 cd - 回 ...
- 爬虫实战(一) 用Python爬取百度百科
最近博主遇到这样一个需求:当用户输入一个词语时,返回这个词语的解释 我的第一个想法是做一个数据库,把常用的词语和词语的解释放到数据库里面,当用户查询时直接读取数据库结果 但是自己又没有心思做这样一个数 ...
- 多校1010 Taotao Picks Apples
>>点击进入原题<< 思路:题解很有意思,适合线段树进阶 #include<cstdio> #include<cmath> #include<cs ...
- [bzoj4300][绝世好题] (动规)
Description 给定一个长度为n的数列ai,求ai的子序列bi的最长长度,满足bi&bi-1!=0(2<=i<=len). Input 输入文件共2行. 第一行包括一个整数 ...
- enum 的使用
public enum Color { RED(), GREEN(), BLANK(), YELLO(); // 成员变量 private String name; private int index ...
- idea 获取当前git最新分支
菜单栏VCS->选中Git 选择Fetch 获取最新分支
- Java基础学习总结(76)——Java异常深入学习研究
异常机制是指当程序出现错误后,程序如何处理.具体来说,异常机制提供了程序退出的安全通道.当出现错误后,程序执行的流程发生改变,程序的控制权转移到异常处理器. 异常处理的流程 当程序中抛 ...
- ViewService
ViewService 在分布式系统中,最常见的场景就是主备架构.但是如果主机不幸宕机,如何正确的通知客户端当前后端服务器的状况成为一个值得研究的问题.本文描述了一种简单的模型用于解决此问题. 背景 ...
- Ubuntu 16.04切换/home中文目录为英文目录
其实这个方法是具有技巧性的,不建议使用. 1.先转换成英文 sudo gedit /etc/default/locale 将内容改为: LANG=”en_US.UTF-8″ LANGUAGE=”en_ ...
- ubuntu 搭建 svn服务器,使用http方式访问
原文: http://blog.csdn.net/wobuxingfang/article/details/70835414 参考:http://www.cnblogs.com/zzugyl/p/36 ...