wp7 开发学习之 Thumb小应用

阅读更多

xaml页面

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

DragDelta="thumb1_DragDelta" DragStarted="thumb1_DragStarted" DragCompleted="thumb1_DragCompleted">


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可以随意拖动

你可能感兴趣的:(wp7,thumb)