WPF and Surface2.0SDK

Source: Internet
Author: User
This article describes how to use the ScatterView control to implement the above functions. Because the touch screen technology is only supported in Windows 7, XP users must upgrade to Windows 7. First, install the Surface2.0SDK and Runtime on Windows 7. You can download the installation program from the official page. After the installation is complete, open VS2010

This article describes how to use the ScatterView control to implement the above functions. Because the touch screen technology is only supported in Windows 7, XP users must upgrade to Windows 7. First, install the Surface 2.0 SDK and Runtime on Windows 7. You can download the installation program from the official page. After the installation is complete, open VS2010

This article describes how to use the ScatterView control to implement the above functions. Because the touch screen technology is only supported in Windows 7, XP users must upgrade to Windows 7. First, install the Surface 2.0 SDK and Runtime on Windows 7. You can download the installation program from the official page. After the installation is complete, open VS2010 to create a new Surface 2.0 project. Select Surface Appliction (WPF) in the template ).

We can add a Label control in the current XAML code. After F5 is run, the Label control cannot perform Manipulating.

     
          
       
  
 

Next, add a ScatterView control to the Grid. We can think of ScatterView as a container that can contain other controls, and these controls can achieve Manipulating effect. For example, we add three controls in ScatterView: Rectangle, Label, and SurfaceTextBox. Some may ask why Rectangle should be placed in ScatterViewItem? In fact, all controls in ScatterView are automatically added to ScatterViewItem by default, so you can omit the ScatterViewItem control if you do not need to set it. In this example, I need to manually write the ScatterViewItem control to adjust the Deceleration value of the Rectangle and adjust the Deceleration parameter.

     
          
               
            
                   
                   
       
  
 

After the above Code is completed, F5 runs again. How do you feel? Does the Manipulating effect become very simple ......

If necessary, the control can be automatically loaded to ScatterView. The following code will automatically add a local image to the program.

private void AddDemoPic(){    string targetPic = @"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg";    ScatterViewItem item = new ScatterViewItem();    mainScatterView.Items.Add(item);    MediaElement pic = new MediaElement();    item.Content = pic;    item.Background = Brushes.Transparent;    if (System.IO.File.Exists(targetPic))    {        pic.Source = new Uri(targetPic);    }    else    {        item.Content = "Picture not found";    }}

So far, the introduction to ScatterView in this article is here. You are welcome to exchange ideas with each other.

For more information, see ScatterView Class.

Author: Li jingran (Gnie)
Source: {GnieTech} (http://www.cnblogs.com/gnielee)

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.