1 //This is a list of commonly used namespaces for a pane.
4 using System
.Windows
.Controls
;
5 using System
.Windows
.Controls
.Primitives
;
6 using System
.Windows
.Documents
;
7 using System
.Windows
.Navigation
;
8 using System
.Windows
.Shapes
;
9 using System
.Windows
.Data
;
10 using System
.Windows
.Media
;
15 /// Interaction logic for Pane1.xaml
18 public partial class Pane1
: Canvas
20 void onDragDelta(object sender
, DragDeltaEventArgs e
)
22 //Move the Thumb to the mouse position during the drag operation
23 double yadjust
= myCanvasStretch
.Height
+ e
.VerticalChange
;
24 double xadjust
= myCanvasStretch
.Width
+ e
.HorizontalChange
;
25 if ((xadjust
>= 0) && (yadjust
>= 0))
27 myCanvasStretch
.Width
= xadjust
;
28 myCanvasStretch
.Height
= yadjust
;
29 Canvas
.SetLeft(myThumb
, Canvas
.GetLeft(myThumb
) +
31 Canvas
.SetTop(myThumb
, Canvas
.GetTop(myThumb
) +
33 changes
.Text
= "Size: " +
34 myCanvasStretch
.Width
.ToString() +
36 myCanvasStretch
.Height
.ToString();
40 void onDragStarted(object sender
, DragStartedEventArgs e
)
42 myThumb
.Background
= Brushes
.Orange
;
45 void onDragCompleted(object sender
, DragCompletedEventArgs e
)
47 myThumb
.Background
= Brushes
.Blue
;