首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

wp7 开发学习之 Thumb小运用

2012-09-04 
wp7 开发学习之 Thumb小应用xaml页面Thumb Height233 HorizontalAlignmentStretch Namethumb1 V

wp7 开发学习之 Thumb小应用

xaml页面

<Thumb Height="233" HorizontalAlignment="Stretch" Name="thumb1" VerticalAlignment="Stretch" Width="290"
DragDelta="thumb1_DragDelta" DragStarted="thumb1_DragStarted" DragCompleted="thumb1_DragCompleted"/>

?

cs页面

public partial class Thumb : PhoneApplicationPage
{
public Thumb()
{
InitializeComponent();
}

//移动中
private void thumb1_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
this.PageTitle.Text = string.Format("x:{0},y:{1}",e.HorizontalChange,e.VerticalChange);
}


//开始
private void thumb1_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
{
this.PageTitle.Text = "started";
}

//完成
private void thumb1_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{
this.PageTitle.Text = "completed";
}
}

?

------------------------------------------

这是第二个应用

xmal

<Thumb Height="233" HorizontalAlignment="Stretch" Name="thumb1" VerticalAlignment="Stretch" Width="290"
DragDelta="thumb1_DragDelta" DragStarted="thumb1_DragStarted" DragCompleted="thumb1_DragCompleted">
<Thumb.RenderTransform>
<TranslateTransform x:Name="tr"></TranslateTransform>
</Thumb.RenderTransform>

</Thumb>

cs:

//移动中
private void thumb1_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{
// this.PageTitle.Text = string.Format("x:{0},y:{1}",e.HorizontalChange,e.VerticalChange);
tr.X = tr.X + e.HorizontalChange;
tr.Y = tr.Y + e.VerticalChange;

}

开始事件 和完成事件 和上面一样了,这个就是thumb可以随意拖动

热点排行