Windows Phone 7手动启动 – WP7手动启动
发布时间:2020-12-14 01:40:38 所属栏目:Windows 来源:网络整理
导读:我在WP7中有一个webscrollview,它最初没有焦点(内容是hittestVisible,因此取消了scrollviewers的hittestvisibility).当我将内容的可见性设置为false时,我可以滚动滚动浏览器,但是仅在解除手指之后再次将其重新放回.我真的很喜欢重点转移,之后重新应用焦点,以
我在WP7中有一个webscrollview,它最初没有焦点(内容是hittestVisible,因此取消了scrollviewers的hittestvisibility).当我将内容的可见性设置为false时,我可以滚动滚动浏览器,但是仅在解除手指之后再次将其重新放回.我真的很喜欢重点转移,之后重新应用焦点,以便我可以在滚动视图获得焦点后滑动,不要等待下一个操作开始事件触发.
这是我的代码: <UserControl x:Class="WTFApp.Resources.ViewControllers.DetailedItemContentControl" 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" xmlns:local="clr-namespace:EiBaseApi.Animation;assembly=EiBaseApi" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480" shell:SystemTray.IsVisible="True" > <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="10"/> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.Resources> <Storyboard x:Name="MediatedListBoxContentAnimator"> <DoubleAnimation x:Name="MediatedAnimation" Storyboard.TargetName="WebScrollViewMediator" Storyboard.TargetProperty="ScrollableWidthMultiplier" > </DoubleAnimation> </Storyboard> </Grid.Resources> <ScrollViewer x:Name="Scroller" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" ManipulationMode="Control" Grid.Row="1" Grid.RowSpan="2" > <StackPanel Name="WebScrollView" Orientation="Horizontal"> <UserControl Name="LeftContentControl" MinWidth="480" /> <UserControl Name="MiddleContentControl" MinWidth="480" /> <UserControl Name="RightContentControl" MinWidth="480" /> </StackPanel> </ScrollViewer> <local:ScrollableItemAnimationMediator x:Name="WebScrollViewMediator" ScrollViewer="{Binding ElementName=Scroller}"/> </Grid> 在C#中: protected override void TouchFrameDelta( object sender,TouchFrameEventArgs e ) { if ( UserManipulating == ManipulationState.ManipulationStopped ) { UserManipulating = ManipulationState.ManipulationStarted; ManipulationStartingPoint = e.GetPrimaryTouchPoint( null ).Position; } //if we are already manipulating the scrollviewer,we do nothing if ( UserManipulating != ManipulationState.ManipulationStarted ) { return; } TouchPoint touchPoint = e.GetPrimaryTouchPoint( null ); float differenceStart = ( float )( touchPoint.Position.X - ManipulationStartingPoint.X ); if ( Math.Abs( differenceStart ) >= 25 ) { if ( BrowserListIsHitTestVisible ) { BrowserListIsHitTestVisible = false; MiddleContentControl.Focus( ); MiddleContentControl.UpdateLayout( ); return; } float differenceDelta = ( float ) ( touchPoint.Position.X - ManipulationDeltaPoint.X ); if ( touchPoint.Action == TouchAction.Up ) { UserManipulating = ManipulationState.ManipilatingScrollViewCompleted; OnManipulationCompleted( differenceDelta ); } } ManipulationDeltaPoint = touchPoint.Position; } TouchFrameDelta是Touch.FrameReported事件.
只是为了澄清,ManipulationStarted(和Completed)不能手动触发,因为它们的EventArgs没有任何公共构造函数被封装.
你所要求的不是我认为可能的事情.由于您的子项目最初不支持任何交互,所以即使在执行另一个事件之前设置了IsHitTestVisible,事件也不会冒泡. 我无法看到您正在尝试归档到这里,但是滚动滚动,并且WebBrowser不是我将推荐使用的7.0 / 7.5,因为控件的功能非常有限. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- powershell – 如何在Windows 10中从命令行打开/关闭Window
- windows-mobile – 如何在Windows Mobile 6.0中将Check Box
- 如何鼓励Windows管理员学习脚本?
- 多图预警!带你走进颠覆互联网企业的(2B)崇才科技
- windows-8 – 适用于Windows 8桌面的虚拟光传感器
- windows – 如何用cmake指定带有空格的路径?
- 添加HTTPS端点后,我收到此警告:在证书存储中找不到“Micro
- windows – Vagrant SMB默认用户名和密码?
- 为什么Microsoft重载方法Console.Write()和Console.WriteLi
- MacOS 下完全卸载 Tuxera NTFS
推荐文章
站长推荐
热点阅读