この投稿の指示に従ってflick
(aka slide
, swipe
) ジェスチャを正常に実装しましたが、何らかの理由で、画面の上半分でしか認識されません。Windows 8 Phone App
シミュレーターと実際の開発デバイス ( Nokia Lumia 520
) でこれを試したところ、同じ結果が得られました。
私のアプリはApplicationBarを使用しており、フリック ジェスチャは偶然にも、ApplicationBarフライオーバーが終了する場所でモーションを認識し始めます (完全に拡張した場合)。
ジェスチャーをリッスンする画像にもtap
イベントがあり、そのイベントは画像全体 (画面の上/下半分) で正常に機能します。
前もって感謝します...
編集:これは、空白のページを作成してまだ運がないことを試したコードです。「フリック」ジェスチャが認識される領域は、電話画面の左上に制限されます (シミュレーターと実際のデバイスの両方で)。
ここに私のコード(CS)があります:
FlickTest.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace Windows_8_Phone_App
{
public partial class FlickTest : PhoneApplicationPage
{
public FlickTest()
{
InitializeComponent();
}
private void image_GestureListener_Flick(object sender, FlickGestureEventArgs e)
{
if (titulo.Text == "Foo")
{
titulo.Text = "Bar";
}
else {
titulo.Text = "Foo";
}
}
}
}
XAML コード:
<phone:PhoneApplicationPage
x:Class="Windows_8_Phone_App.FlickTest"
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:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Landscape" Orientation="Landscape"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="titulo" Text="page name" Margin="9,-7,0,0" />
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Image x:Name="imagen" HorizontalAlignment="Left" Height="309" Margin="10,0,0,0" VerticalAlignment="Top" Width="694" Source="/Assets/AppBar/basecircle.png" Stretch="Fill">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener Flick="image_GestureListener_Flick" />
</toolkit:GestureService.GestureListener>
</Image>
</Grid>
</Grid>
</phone:PhoneApplicationPage>