Http://kb.cnblogs.com/page/71478/author: gnie Source: blog site Release Date: Reading: 443 Original article link full screen reading [favorites] Abstract: No matter which kind of touch screen operations, developers need to write them one by one Code This article will introduce you to an efficient multi-point touch screen development mode.
Previous articlesArticleHas introduced a variety of touch screen operations, and has a better understanding of its development methods. Careful friends should find that in the previous article, if the image is dragged too fast, it will fly out of inertiaProgramOutside the window, that is, you also need to perform development related to its boundary limitations. In addition, no matter which kind of touch screen operations, developers need to write code one by one. This article will introduce an efficient multi-point touch screen development mode.
In fact, we only need to use the multi-touch manipulation project in codeplex. This program not only supports WPF, but also supports Silverlight and Windows Phone 7 project development. Download and install the program, open blend 4 to create a new project, and draw a rectangle in the design window.
In the behaviors menu, you can find the fluidmovebehavior and translatezoomrotatebehavior options, and drag them into the rectangle to make the rectangle touch screen.
Select translatezoomrotatebehavior to perform relevant settings. Check constraintoparentbounds to prevent the rectangle from flying out of the program.
In fluidmovebehavior, you can set attributes such as the moving mode and duration of the rectangle.
After the relevant settings are complete, check the generated code. It can be seen that XAML is actually quite simple.
< Window
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns : X = "Http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns : I = "Http://schemas.microsoft.com/expression/2010/interactivity"
Xmlns : EI = "Http://schemas.microsoft.com/expression/2010/interactions"
X : Class = "Wpfmt. mainwindow" X : Name = "Window" Title = "Mainwindow"
Width = "640" Height = "480">
< Grid X : Name = "Layoutroot" Background = "# Ff7e7878">
< Rectangle Fill = "# Ff0b3eda" Margin = "239,181,289,179" Stroke = "Black">
< I : Interaction. Behaviors >
< EI : Translatezoomrotatebehavior Constraintoparentbounds = "True"/>
< EI : Fluidmovebehavior Duration = "0: 0">
< EI : Fluidmovebehavior. easey >
< Backease Easingmode = "Easeout"/>
</ EI : Fluidmovebehavior. easey >
< EI : Fluidmovebehavior. easex >
< Backease Easingmode = "Easeout"/>
</ EI : Fluidmovebehavior. easex >
</ EI : Fluidmovebehavior >
</ I : Interaction. Behaviors >
</ Rectangle >
</ Grid >
</ Window >
Program demonstration
Through the above development in blend 4, you can implement multi-point touch screen operation without writing any code.
Related Articles
1. WPF multi-touch development: Install multi-point touch screen simulator on Windows 7
2. WPF multi-touch development: Raw touch)
3. WPF multi-touch development: Manipulation)
4. WPF multi-touch development: Inertia)
Download source code: wpfmt.zip