added samples
[windows-sources.git] / sdk / samples / WPFSamples / Thumb / csharp / pane1.xaml.cs
blobbfdf1a09e58d1dc510f0f3cb78f38fc10e2d868f
1 //This is a list of commonly used namespaces for a pane.
2 using System;
3 using System.Windows;
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;
12 namespace Thumb_wcp
14 /// <summary>
15 /// Interaction logic for Pane1.xaml
16 /// </summary>
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) +
30 e.HorizontalChange);
31 Canvas.SetTop(myThumb, Canvas.GetTop(myThumb) +
32 e.VerticalChange);
33 changes.Text = "Size: " +
34 myCanvasStretch.Width.ToString() +
35 ", " +
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;