您的位置:首页 > 产品设计 > UI/UE

Windows Phone UI控件

2013-03-16 15:43 363 查看
培训第一章
XAML介绍
属性设置
设置方式:
1: 特性设置
2: 使用属性元素

属性继承

XAML中的颜色和画刷

Content属性

资源定义和访问
共享机制 画刷 外观 文字等

Style使用与继承
Style是属性集合,也属于资源,多用于对象元素

主题与渐变使用
Windows Phone预定了很多资源,通过StaticResource来用这些资源
资源包括:颜色,画刷,字体名称,字体大小,边距等

培训第二章 UI控件
基础控件
控件继承图
布局控件
Grid
支持网格布局
自定义行列数
Grid.RowDefinitions 定义行
Grid.ColumnDefinitions 定义列
Auto表示此行根据内容自动调整
*代表取余下的长度

Canvas
绝对布局的容器控件
使用Canvas.Left和Canvas.Top
Canvas.Zindex处理叠加处理

StackPanel
使多个子控件按照横向或者纵向排列
Orientation(排列方向)
Horizontal
Vertical
三个Panel的区别

Border控件
绘制边框
扮演容器控件角色

Image控件
显示本地或者远程图片
可以对图片进行裁剪,Mask

Shape控件
用于绘制几何图形
主要包括的控件
Ellipse(椭圆)
Polygon(多边形)

Control控件
按钮和选择控件
按钮:
Button
与用户交互
Button可以做如下风格
内嵌图片
背景色
设置背景画刷
设置背景为图片画刷

HyperlinkButton
用来作为超链接按钮
支持页面导航
设置链接属性:
NavigateUri="Http://";
NavigateUri="/MainPage.xaml";

RepeatButton
按下时,不断的触发Click事件

选择控件:
CheckBox(选择框控件)
为用户提供选项,一般用于多选
支持三态:选中,中间态,未选中
注意:要使中间态有效需要设置如下: IsThreeState="true"

ReadioButton
用户选择控件,用于单选
分组方式有两种
1:不同的分组,放到不同的容器
2:通过GruoupName属性

Slider(滑杆控件)
以拖动方式在指定范围内进行
属性Orientation指定水平或者垂直
属性Maximum和Minimum用于定义

文本控件
TextBlock
强大的文本标签
lnlines(内联属性)
是LineBreak和Run对象的集合
一个内联中,可以有多个LineBreak
LineBreak表示换行
Run可以对文本设置不同的字体颜色

TextBox
普通的文本采集控件
支持换行
TextWrapping="Wrap"
InputScope限定输入内容

PasswordBox
密码采集控件
属性PasswordChan

Item控件
Pivot控件(枢轴控件)
虚拟出比手机宽度更宽的空间
水平方式组织多个屏幕内容
Pivot包含Pivotltem类型的子项
Pivotltem里面可以是不同的控件

Panorama控件(全景控件)
虚拟出比手机宽度更宽的空间
水平方式组织多个屏幕内容
Panorama包含PanoramaItem类型

ScrollViewer
当子控件尺寸超出其大小时,可以进行拖动浏览
滚动条属性(默认只能垂直滚动)
HorizontalScrollBarVisibility
VerticalScrollBarVisibility

PropressBar(进度条)
进度条控件
有两种类型
进度递增
几个小点不断循环
当知道具体的进度时,采用第一种,当进度不明确时,可采用第二种
ToolKit控件
ToolKit介绍与使用
微软Siverlight团队开发的一个产品,为了丰富windows phone的UI控件

导航效果(翻页特效)
ListPicker
列表选择控件
相当于Windows中的ComboBox控件
ListPickerItem:集合项

PhoneTextBox
高级的TextBox
支持:
Hint提示
Actionlcon(动作图标)
字数限制提示

TiltEffect(控件倾斜)
替代用户按下(pressed)和未按下(unpressed)
三个主要属性
Tiltableltems
IsTiltEnabled
SupressTile
使用方法s
1: 全局倾斜
2: 应用到某个控件上
3: 静止倾斜
4: 添加更多的控件到TiltableItems中
HubTile
轮询磁贴
可以使用图片,标题,消息和通知
支持反转
事件响应
事件
简介
路由事件
事件的传递
从顶层控件传递到PhoneApplicationFrame
一些常见的事件:
PropertyChanged----属性更改
Click---单击
页面导航相关事件
应用程序状态变化通知事件

触摸
原生触摸
程序级别
提供比较低层的触控编程接口
注册Touch.FrameReported事件
事件信息存放在TouchFrameEvent
参数属性:
Timestamp:获取事件

高级触摸
Manipulation

手势识别


  

<Grid x:Name="LayoutRoot" Background="Transparent">

<!--
<Grid Margin="10,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="130" />
<RowDefinition Height="130" />
<RowDefinition Height="*" />
<RowDefinition Height="130" />
<RowDefinition Height="130" />
</Grid.RowDefinitions>

<Grid x:Name="RowOne" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Content="日历"
Style="{StaticResource gb}" />

<Button Grid.Column="1"
Content="系统"
Style="{StaticResource gb}" />

<Button Grid.Column="2"
Content="网络"
Style="{StaticResource gb}" />

<Button Grid.Column="3"
Content="短信"
Style="{StaticResource gb}" />
</Grid>

<Grid Grid.Row="1">
<Button Width="120"
HorizontalAlignment="Left"
Content="视频"
Style="{StaticResource gb}" />
<Button Width="120"
HorizontalAlignment="Right"
Content="录音"
Style="{StaticResource gb}" />
</Grid>

<Grid Grid.Row="2">
<Button Width="400"
Content="商店"
FontSize="60"
Style="{StaticResource gb}" />
</Grid>

<Grid Grid.Row="3">
<Button HorizontalAlignment="Left"
Content="帮助"
Style="{StaticResource gb}" />
<Button HorizontalAlignment="Right"
Content="设置"
Style="{StaticResource gb}" />
</Grid>

<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Content="阅读"
Style="{StaticResource gb}" />

<Button Grid.Column="1"
Content="UC"
Style="{StaticResource gb}" />

<Button Grid.Column="2"
Content="QQ"
Style="{StaticResource gb}" />

<Button Grid.Column="3"
Content="升级"
Style="{StaticResource gb}" />
</Grid>

</Grid>
-->

<!--
<Canvas Width="100"
Height="100"
Background="Brown"
Left="150"
Top="150"
ZIndex="3" />
<Canvas Width="200"
Height="200"
Background="Blue"
Left="100"
Top="100"
ZIndex="2" />
<Canvas Width="300"
Height="300"
Background="Chartreuse"
Left="50"
Top="50"
ZIndex="1" />
-->

<!--  靠没达到理想的效果  -->
<!--
<StackPanel Orientation="Vertical">
<Button Height="150" Content="确定" />
<Grid Height="300" Background="Brown">
<StackPanel Orientation="Horizontal">
<Button Height="100" Content="登录" />
<Button Height="100" Content="退出" />
</StackPanel>
</Grid>
</StackPanel>
-->

<!--
<Border Width="400"
Height="200"
Margin="28,150,28,275"
Background="Red"
BorderBrush="Green"
BorderThickness="50,0,50,0"
CornerRadius="100">
<Button Content="Button" />
</Border>
-->

<!--
<Image Width="339"
Height="244"
HorizontalAlignment="Center"
Source="./Windows-Phone-8.jpg" />
-->

<!--
<Grid x:Name="ContentPanel"
Grid.Row="1"
Margin="12,0,12,0">
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<Ellipse Width="200"
Height="200"
Fill="Green" />
<Rectangle Width="200"
Height="50"
Fill="Red" />
</StackPanel>
</Grid>
-->

<!--  button  -->
<!--
<Button Name="button1"
Width="321"
Height="89"
Margin="87,-5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Button.Content>
<Image Width="218" Source="Windows-Phone-8.jpg" />
</Button.Content>
</Button>

<Button Name="button2"
Width="321"
Height="72"
Margin="87,82,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="#FFB81BD4"
BorderBrush="CadetBlue"
Content="Button" />

<Button Name="button3"
Width="321"
Height="72"
Margin="87,153,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Button">
<Button.Background>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Offset="0" Color="BlueViolet" />
<GradientStop Offset="1" Color="CadetBlue" />
</LinearGradientBrush>
</Button.Background>
</Button>

<Button Name="button4"
Height="72"
Margin="87,225,48,0"
VerticalAlignment="Top"
Content="Button">
<Button.Background>
<ImageBrush ImageSource="Windows-Phone-8.jpg" />
</Button.Background>
</Button>

<HyperlinkButton Name="htperlinkButton1"
Width="321"
Height="66"
Margin="87,391,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Brown"
Content="www.baidu.com"
NavigateUri="Http://www.baidu.com"
TargetName="devdiv" />

<HyperlinkButton Name="hyperlinkButton2"
Width="321"
Height="59"
Margin="87,309,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Chartreuse"
Content="MainPage"
NavigateUri="MainPage.xaml" />

<RepeatButton Name="repeatButton"
Width="321"
Height="81"
Margin="87,462,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="DarkBlue"
Click="repeaBtn_Click"
Content="0"
Delay="400" />
-->

<!--  CheckBox  -->
<!--
<CheckBox Name="mychkBox"
Width="190"
VerticalAlignment="Top"
Background="Brown"
Checked="chkBox_Checked"
Foreground="Chartreuse"
IsThreeState="True"
Unchecked="chkBox_Unchecked">
<CheckBox.RenderTransform>
<CompositeTransform ScaleX="1.5" ScaleY="1.5" />
</CheckBox.RenderTransform>
</CheckBox>

<RadioButton Name="radioButton1"
Width="220"
Height="72"
Margin="145,225,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Blue"
Content="男" />

<RadioButton Name="radioButton2"
Width="220"
Height="72"
Margin="245,225,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Blue"
Content="女" />
-->

<!--  Slider  -->
<!--
<TextBlock Name="sliderText" />
<Slider Name="slider"
Width="407"
Height="115"
Margin="49,482,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
LargeChange="2"
Maximum="100"
Minimum="0"
SmallChange="0.1"
ValueChanged="slider_ValueChanged" />

<Slider Name="slider2"
Width="59"
Height="325"
Margin="6,0,0,55"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Background="Brown"
BorderBrush="Chartreuse"
Foreground="Black"
Orientation="Vertical"
ValueChanged="slider_ValueChanged" />
-->

<!--  TextBlock  -->
<!--
<StackPanel Width="456"
Height="607"
HorizontalAlignment="Left"
VerticalAlignment="Top">

<TextBlock Width="253"
Height="114"
Margin="87,0,0,0"
HorizontalAlignment="Left"
TextWrapping="Wrap">
<TextBlock.Inlines>
<Run FontSize="30"
FontStyle="Italic"
FontWeight="Thin"
Foreground="#ff1fdb3c"
Text="Windows Phone 8" />
<LineBreak />
<Run FontSize="30"
Foreground="Blue"
Text="开发" />
<Run FontSize="50"
Foreground="Chartreuse"
Text="体验" />
</TextBlock.Inlines>
</TextBlock>

<TextBox Width="410"
Height="221"
Margin="87,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
InputScope="Text"
Text="TextBox"
TextWrapping="Wrap" />

<PasswordBox Width="410"
Height="93"
Margin="36,0,0,0"
HorizontalAlignment="Left"
PasswordChar="*" />

</StackPanel>
-->

<!--  pivot  -->
<!--
<phone:Pivot Title="Pivot控件">
<phone:Pivot.Background>
<ImageBrush ImageSource="Windows-Phone-8.jpg" />
</phone:Pivot.Background>

<phone:PivotItem Header="文本">
<TextBox Width="436"
Height="589"
Margin="10,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="BlueViolet"
Foreground="CadetBlue"
Text="    W   Indows Phone 8是微软公司6月21日最新发布的一款手机操作系统,是Windows Phone系统的最新版本,也是目前Windows Phone的第三个大型版本。Windows Phone 8采用和Windows 8相同的针对移动平台精简优化NT内核并内置诺基亚地图。"
TextWrapping="Wrap" />
</phone:PivotItem>

<phone:PivotItem Header="图片">
<ScrollViewer Name="scrollViewer1"
Width="446"
Height="597"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Chartreuse"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<Image Name="img"
Width="800"
Height="600"
Source="Windows-Phone-8.jpg" />
</ScrollViewer>
</phone:PivotItem>
</phone:Pivot>
-->

<!--
<phone:Panorama Title="Panorama控件">
<phone:Panorama.Background>
<ImageBrush ImageSource="Windows-Phone-8.jpg" />
</phone:Panorama.Background>

<phone:PanoramaItem Header="文本">
<TextBox Width="436"
Height="468"
Margin="0,0,0,15"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Background="Brown"
Foreground="CadetBlue"
Text="WIndows Phone 8是微软公司6月21日最新发布的一款手机操作系统,是Windows Phone系统的最新版本,也是目前Windows    Phone的第三个大型版本。Windows Phone 8采用和Windows 8相同的针对移动平台精简优化NT内核并内置诺基亚地图。"
TextWrapping="Wrap" />
</phone:PanoramaItem>

<phone:PanoramaItem Header="图片">
<ScrollViewer Name="scrollViewer1"
Width="446"
Height="600"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Chocolate"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<Image Name="img"
Width="800"
Height="600"
Source="Windows-Phone-8.jpg"
Stretch="Fill" />

</ScrollViewer>
</phone:PanoramaItem>
</phone:Panorama>
-->

<!--
<ScrollViewer Name="scrollViewer1"
Width="362"
Height="362"
Margin="41,67,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="DarkKhaki"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<Image Name="img"
Width="500"
Height="400"
Source="Windows-Phone-8.jpg"
Stretch="Fill" />

</ScrollViewer>
-->

<!--  进度条 ProgressBar  -->
<!--
<ProgressBar Name="progressBar2"
Width="431"
Height="34"
Margin="25,317,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
IsIndeterminate="True" />

<ProgressBar Name="progressbar1"
Width="431"
Height="20"
Margin="25,204,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Value="50" />
-->

<!--  ToolKit  -->
<!--
<Grid x:Name="ContentPanel"
Grid.Row="1"
Margin="12,0,12,0">

<toolKit:PhoneTextBox Margin="-10,96,10,435"
ActionIcon="Windows-Phone-8.jpg"
ActionIconTapped="Search_ActionIconTapped"
Hint="请输入搜索内容"
HintStyle="{StaticResource HintCustomStyle}"
LengthIndicatorVisible="True"
MaxLength="10" />
<toolKit:ListPicker>
<toolKit:ListPickerItem Content="睡觉" />
<toolKit:ListPickerItem Content="上班" />
<toolKit:ListPickerItem Content="下班" />
</toolKit:ListPicker>

<Button Name="button"
Width="251"
Margin="80,206,0,342"
HorizontalAlignment="Left"
Background="Red"
Content="斜"
Foreground="White" />
</Grid>
-->

<!--
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<toolKit:HubTile Title="艺术"
Grid.Row="0"
Grid.Column="0"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="BurlyWood"
DisplayNotification="true"
Message="多彩贵州 舞蹈大赛决赛在贵州电视台演播厅举行。图为女子集体民族民间舞比赛中。黔中早报 罗禹 摄"
Notification="5"
Source="/images/00.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="奥运"
Grid.Row="0"
Grid.Column="1"
Width="218"
Height="172"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="BurlyWood"
DisplayNotification="True"
Message="英国伦敦,2012奥运会闭幕式现场。"
Notification="6"
Source="/images/01.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="风情"
Grid.Row="1"
Grid.Column="0"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="CadetBlue"
DisplayNotification="True"
Message="印度孟买,印度教信徒们在叠罗汉,组成人体金字塔。叠罗汉是印度教徒的传统活动,以庆祝神明克利须那神"
Notification="8"
Source="/images/10.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="少儿"
Grid.Row="1"
Grid.Column="1"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Chocolate"
DisplayNotification="true"
Message="在安徽省亳州市文帝东路亳州体操训练基地体操馆内,孩子们正在教练的指导下强化训练。"
Notification="10"
Source="/images/11.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="国际"
Grid.Row="2"
Grid.Column="0"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Coral"
DisplayNotification="true"
Message="一名男子正在参拜位于东京的靖国神社。当天是日本二战投降67周年。"
Notification="1"
Source="/images/20.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="新闻"
Grid.Row="2"
Grid.Column="1"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="BurlyWood"
DisplayNotification="true"
Message="载有14人的香港保钓船启丰二号成功登上钓鱼岛,并将五星红旗插在钓鱼岛上。"
Notification="9"
Source="/images/21.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="环保"
Grid.Row="3"
Grid.Column="0"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Coral"
DisplayNotification="True"
Message="陈光标和《甄嬛传》中槿汐的扮演者孙茜将现场的铅酸电池电动车砸碎,断然拒绝铅污染。"
Notification="4"
Source="/images/30.jpg"
Tap="hubTile_Tap" />
<toolKit:HubTile Title="电影"
Grid.Row="3"
Grid.Column="1"
Width="218"
Height="172"
Margin="5,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="Chartreuse"
DisplayNotification="True"
Message="第69届威尼斯电影节开幕。意大利女星玛里尼-瓦勒丽亚走红毯。"
Notification="7"
Source="/images/31.jpg"
Tap="hubTile_Tap" />
-->

<!--
<Grid x:Name="ContentPanel"
Grid.Row="1"
Margin="12,0,12,0">
<StackPanel>
<TextBlock Name="textBlick1" TextWrapping="Wrap" />
<TextBlock Name="textBlick2" TextWrapping="Wrap" />
<TextBlock Name="textBlick3" TextWrapping="Wrap" />
<TextBlock Name="textBlick4" TextWrapping="Wrap" />
<TextBlock Name="textBlick5" TextWrapping="Wrap" />
<TextBlock Name="textBlick6" TextWrapping="Wrap" />
</StackPanel>

<Button Height="100"
VerticalAlignment="Center"
Background="Blue"
Content="点击" />
</Grid>
-->

<Grid x:Name="ContentPanel"
Grid.Row="1"
Margin="12,0,12,0">
<TextBlock Name="txtBlk"
VerticalAlignment="Top"
Text="" />
<Button Name="btn"
Width="169"
Height="132"
Margin="133,136,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="拖我啊!"
ManipulationCompleted="btn_ManipulationCompleted"
ManipulationDelta="btn_ManipulationDelta"
ManipulationStarted="btn_ManipulationStarted">

<Button.RenderTransform>
<TranslateTransform x:Name="translatedTransform" />
</Button.RenderTransform>
</Button>

</Grid>

</Grid>


  

//private void repeaBtn_Click(object sender, RoutedEventArgs e)
//{
//int count = Convert.ToInt32(repeatButton.Content);
//repeatButton.Content = ++count;
//}

/*private void chkBox_Checked(object sender, RoutedEventArgs e)
{
if (mychkBox.IsChecked == true)
{
MessageBox.Show("选择");
}
}

private void chkBox_Unchecked(object sender, RoutedEventArgs e)
{
if (mychkBox.IsChecked == false)
{
MessageBox.Show("未选");
}
}*/

/*private void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Slider slidertemp = (Slider) sender;
this.sliderText.Text = slidertemp.Value.ToString();
}*/

/*private void Search_ActionIconTapped(object sendeer, EventArgs e)
{
MessageBox.Show("开始搜索!");
}*/

/*private void hubTile_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
HubTile tile = (HubTile) sender;
MessageBox.Show(tile.Message, tile.Title, MessageBoxButton.OK);
}*/

/*private void TouchFrameReported(object sender, TouchFrameEventArgs e)
{
//传入null表明获取到的触控点信息是以屏幕左上角为原点的
TouchPoint mainPoint = e.GetPrimaryTouchPoint(null);
if (mainPoint != null)
{
textBlick1.Text = "主触控点的行为,Action: "+mainPoint.Action.ToString();
textBlick2.Text = "主触控点位置,Position: X" + mainPoint.Position.X.ToString()+"Y:"+mainPoint.Position.Y.ToString();
textBlick3.Text = "主触控点的范围,Size.Width:"+mainPoint.Size.Width.ToString()+",Size.Height:"+mainPoint.Size.Height.ToString();
textBlick4.Text = "主触控点设置ID,TouchDevice.Id:"+mainPoint.TouchDevice.Id.ToString();
textBlick5.Text = "主触控点点中哪 个UIElement元素:" + (mainPoint.TouchDevice.DirectlyOver as FrameworkElement).Name.ToString();

}

TouchPointCollection points = e.GetTouchPoints(null);
int i = 0;
textBlick6.Text = "";
if (points != null)
{
//列举触控点的集合
foreach (var point in points)
{
i++;
textBlick6.Text += "Position" + i + "X:" + point.Position.X.ToString() + " Y" + i + " " +
point.Position.Y.ToString() + " " + point.Action.ToString() + "\n";
}
}
}*/

private void btn_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
txtBlk.Text = "btn_ManipulationStarted";
}

private void btn_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
//使控件跟着触控点走
this.translatedTransform.X += e.DeltaManipulation.Translation.X;
this.translatedTransform.Y += e.DeltaManipulation.Translation.Y;

txtBlk.Text = "btn_ManipulationDelta"+"\n"+" Translation X:"+e.DeltaManipulation.Translation.X+" Y:"+e.DeltaManipulation.Translation.Y+"\n"
+"Cumulative X:"+e.CumulativeManipulation.Translation.X+" Y:"+e.CumulativeManipulation.Translation.Y+" LinearVelocity X:"+e.Velocities.LinearVelocity.X+" Y:"+e.Velocities.LinearVelocity.Y+" IsInertial:"+e.IsInertial;

}

private void btn_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
txtBlk.Text = "btn_ManipulationCompleted "+"\n"+" TotalManipulation.Translation.X:"+e.TotalManipulation.Translation.X+" Y:"+e.TotalManipulation.Translation.Y+"\n"+"FinalVelocities: X:"+e.FinalVelocities.LinearVelocity.X+" Y:"+e.FinalVelocities.LinearVelocity.Y+" IsInertial:"+e.IsInertial;
}


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐