Windows 8 Store Apps Learning (49) Input: Get input device information

Source: Internet
Author: User
Tags touch xmlns

Input: Get input device information, virtual keyboard, Tab navigation, pointer, Tap, Drag, Drop

Introduced

Re-imagine the Windows 8 Store Apps input

Enter information about the device

Application of SIP (Soft Input Panel)

Tab Key Navigation

Pointer-pointers, mouse

Tap-Touch

Drag and Drop

Example

1. Demonstrates how to obtain information about input devices

Input/inputdeviceinfo.xaml

<page
    x:class= "XamlDemo.Input.InputDeviceInfo"
    xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/ Presentation "
    xmlns:x=" Http://schemas.microsoft.com/winfx/2006/xaml "
    xmlns:local=" Using:XamlDemo.Input "
    xmlns:d=" http://schemas.microsoft.com/expression/blend/2008 "
    xmlns:mc=" http:// schemas.openxmlformats.org/markup-compatibility/2006 "
    mc:ignorable=" D ">
    
    <grid background=" Transparent ">
        <grid margin=" 0 0 0 ">
    
            <scrollviewer margin=" 0 0 ">
                <textblock Name= "lblmsg" fontsize= "14.667" textwrapping= "Wrap"/>
            </ScrollViewer>
    
        </Grid>
    < /grid>
</Page>

Input/inputdeviceinfo.xaml.cs

* * Demonstrates how to obtain information about the input device * * using System;
Using Windows.Devices.Input;
Using Windows.UI.Xaml.Controls;
    
Using Windows.UI.Xaml.Navigation;
        Namespace Xamldemo.input {public sealed partial class Inputdeviceinfo:page {public Inputdeviceinfo () {this.
        InitializeComponent ();
            } protected override void Onnavigatedto (NavigationEventArgs e) {//Get information about the mouse device
            Mousecapabilities mousecapabilities = new Mousecapabilities (); Lblmsg.text = "Mousecapabilities.mousepresent:" + mousecapabilities.mousepresent;
            Whether there is a mouse lblmsg.text + = Environment.NewLine; Lblmsg.text + = "Mousecapabilities.horizontalwheelpresent:" + mousecapabilities.horizontalwheelpresent;
            Whether there is a horizontal roller lblmsg.text + = Environment.NewLine; Lblmsg.text + = "Mousecapabilities.verticalwheelpresent:" + mousecapabilities.verticalwheelpresent; Is there a vertical roller lblmsg.text + = EnvironmeNt.
            newline; Lblmsg.text + = "Mousecapabilities.swapbuttons:" + mousecapabilities.swapbuttons;
            Whether to exchange the left and right button lblmsg.text + = Environment.NewLine; Lblmsg.text + = "Mousecapabilities.numberofbuttons:" + mousecapabilities.numberofbuttons;
            The number of buttons on the mouse lblmsg.text + = Environment.NewLine;
    
            Lblmsg.text + = Environment.NewLine;
            Get information about the hardware keyboard device keyboardcapabilities keyboardcapabilities = new Keyboardcapabilities (); Lblmsg.text + = "Keyboardcapabilities.keyboardpresent:" + keyboardcapabilities.keyboardpresent;
            Is there a hardware keyboard lblmsg.text + = Environment.NewLine;
    
            Lblmsg.text + = Environment.NewLine;
            Get information about the touch device touchcapabilities touchcapabilities = new Touchcapabilities (); Lblmsg.text + = "Touchcapabilities.touchpresent:" + touchcapabilities.touchpresent;
            Whether there is a touch device lblmsg.text + = Environment.NewLine; Lblmsg.text = "Touchcapabilities.contacts:" + touchcapabilities.contacts;
            Touch device supported multi-touch points lblmsg.text + = Environment.NewLine;
    
            Lblmsg.text + = Environment.NewLine;
            Get information about pointer devices (touch, Pen, Mouse) var pointerdevicelist = Pointerdevice.getpointerdevices ();
            int displayindex = 0;
    
                foreach (Pointerdevice pointerdevice in pointerdevicelist) {displayindex++;
                Lblmsg.text + = "pointer Device Index:" + displayindex;
                Lblmsg.text + = Environment.NewLine; Lblmsg.text + = "Pointerdevice.pointerdevicetype:" + pointerdevice.pointerdevicetype;
                Pointer type (touch, Pen, Mouse) Lblmsg.text + = Environment.NewLine; Lblmsg.text + = "pointerdevice.isintegrated:" + pointerdevice.isintegrated;
                is the integrated device lblmsg.text + = Environment.NewLine; Lblmsg.text + = "pointerdevice.maxcontacts:" + PointerdeVice. maxcontacts;
                The largest number of simultaneous touch points lblmsg.text + = Environment.NewLine; Lblmsg.text + = "Pointerdevice.physicaldevicerect:" + pointerdevice.physicaldevicerect;
                Physical equipment of the Rect lblmsg.text + = Environment.NewLine; Lblmsg.text + = "Pointerdevice.screenrect:" + pointerdevice.screenrect;
                The pointer device supports a screen of Rect lblmsg.text + = Environment.NewLine;
            Lblmsg.text + = Environment.NewLine; }
        }
    }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.