A thumb class that represents a control that can be dragged by the user. Its main three events were dragdelta,dragstarted,dragcompleted.
dragdelta--when a Thumb control has logical focus and mouse capture, it occurs one or more times as the mouse position changes.
dragstarted--occurs when the Thumb control receives logical focus and mouse capture.
dragcompleted--occurs when the Thumb control loses mouse capture.
1 <window.resources>
2 <resourcedictionary>
3 <controltemplate x:key= "Template1" &G T
4 <ellipse width= "height=";
5 <ellipse.fill>
6 <solidcolorbrush color= "Black" ></SOLIDCOLORBRUSH>
7 </ellipse.fill
8 </ellipse>
9 </controltemplate>
</RESOURCEDICTIONARY&G T
one </window.resources>
<canvas name= "MyCanvas";
<thumb name= "Mythumb" Drag Delta= "Ondragdelta" background= "Blue" dragstarted= "mythumb_dragstarted" dragcompleted= "mythumb_dragcompleted"
canvas.left= "0" canvas.top= "0" width= "height=" "/>";
<!--template= "{STATICR Esource Template1} ", if this method is used to bind the thumb template, it is not possible to change the background of the--> through the dragstarted,dragcompleted event;
</Canvas>
1 void Ondragdelta (object sender, DragDeltaEventArgs e)
2 {
3 canvas.setleft (Mythumb, Canvas.getleft (mythumb) + E.horizontalchange);
4
5 canvas.settop (Mythumb, Canvas.gettop (mythumb) + e.verticalchange);
6
7 }
9 private void Mythumb_dragstarted (object sender, Dragstartedeventargs e)
Ten {
One mythumb.background = Brushes.orange;
-- }
+ private void mythumb_dragcompleted (object sender, DragCompletedEventArgs e)
{
mythumb.background = Brushes.blue;
+ }
Go Wpf--thumb