Windows 8 Store Apps學習(50) 輸入: 側邊手勢, 手勢操作, 手勢識別

來源:互聯網
上載者:User

介紹

重新想象 Windows 8 Store Apps 之 手勢

監測側邊手勢

手勢操作 - Manipulate 的應用(位移手勢,縮放手勢,旋轉手勢)

手勢識別 - GestureRecognizer 的應用

樣本

1、示範如何監測側邊手勢

Input/Touch/EdgeGestureDemo.xaml

<Page    x:Class="XamlDemo.Input.Touch.EdgeGestureDemo"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:local="using:XamlDemo.Input.Touch"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    mc:Ignorable="d">        <Grid Background="Transparent">        <StackPanel Margin="120 0 0 0">                            <TextBlock Name="lblMsg" FontSize="14.667" />                        </StackPanel>    </Grid></Page>

Input/Touch/EdgeGestureDemo.xaml.cs

/* * 示範如何監測側邊手勢 *  * EdgeGesture - 側邊手勢的協助類 *     GetForCurrentView() - 擷取當前的 EdgeGesture 對象 *     Starting - 側邊手勢開始時觸發的事件 *     Completed - 側邊手勢完成後觸發的事件 *     Canceled - 側邊手勢取消後觸發的事件 *      * EdgeGestureEventArgs - 觸發側邊手勢事件後的事件參數 *     EdgeGestureKind - 側邊手勢的輸入類型(Touch, Keyboard, Mouse) */    using System;using Windows.UI.Input;using Windows.UI.Xaml.Controls;    namespace XamlDemo.Input.Touch{    public sealed partial class EdgeGestureDemo : Page    {        public EdgeGestureDemo()        {            this.InitializeComponent();                EdgeGesture edgeGesture = EdgeGesture.GetForCurrentView();                edgeGesture.Canceled += edgeGesture_Canceled;            edgeGesture.Completed += edgeGesture_Completed;            edgeGesture.Starting += edgeGesture_Starting;        }            void edgeGesture_Starting(EdgeGesture sender, EdgeGestureEventArgs args)        {            lblMsg.Text += "EdgeGesture Starting";            lblMsg.Text += Environment.NewLine;        }            void edgeGesture_Completed(EdgeGesture sender, EdgeGestureEventArgs args)        {            lblMsg.Text += "EdgeGesture Completed";            lblMsg.Text += Environment.NewLine;        }            void edgeGesture_Canceled(EdgeGesture sender, EdgeGestureEventArgs args)        {            lblMsg.Text += "EdgeGesture Canceled";            lblMsg.Text += Environment.NewLine;        }    }}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.