xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
xmlns:d='http://schemas.microsoft.com/expression/blend/2008'
xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'
mc:Ignorable='d'
d:DesignWidth='640' d:DesignHeight='480'>
//File: Page.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SilverlightApplication3
{
public partial class MainPage : UserControl
{
Point Origin1 = new Point();
Point Origin2 = new Point();
Point Origin3 = new Point();
public MainPage()
{
// Required to initialize variables
InitializeComponent();
}
private void Flower1_MouseDown(object sender, MouseButtonEventArgs e)
{
Flower1.CaptureMouse();
Origin1.X = Convert.ToDouble(Flower1.GetValue(Canvas.LeftProperty));
Origin1.Y = Convert.ToDouble(Flower1.GetValue(Canvas.TopProperty));
Flower1.SetValue(Canvas.LeftProperty, Shadow1.GetValue(Canvas.LeftProperty));
Flower1.SetValue(Canvas.TopProperty, Shadow1.GetValue(Canvas.TopProperty));
}
private void Flower1_MouseUp(object sender, MouseButtonEventArgs e)
{
Flower1.ReleaseMouseCapture();
Flower1.SetValue(Canvas.LeftProperty, Origin1.X);
Flower1.SetValue(Canvas.TopProperty, Origin1.Y);
}
private void Flower2_MouseDown(object sender, MouseButtonEventArgs e)
{
Flower2.CaptureMouse();
Origin2.X = Convert.ToDouble(Flower2.GetValue(Canvas.LeftProperty));
Origin2.Y = Convert.ToDouble(Flower2.GetValue(Canvas.TopProperty));
Flower2.SetValue(Canvas.LeftProperty, Shadow2.GetValue(Canvas.LeftProperty));
Flower2.SetValue(Canvas.TopProperty, Shadow2.GetValue(Canvas.TopProperty));
}
private void Flower2_MouseUp(object sender, MouseButtonEventArgs e)
{
Flower2.ReleaseMouseCapture();
Flower2.SetValue(Canvas.LeftProperty, Origin2.X);
Flower2.SetValue(Canvas.TopProperty, Origin2.Y);
}
private void Flower3_MouseDown(object sender, MouseButtonEventArgs e)
{
Flower3.CaptureMouse();
Origin3.X = Convert.ToDouble(Flower3.GetValue(Canvas.LeftProperty));
Origin3.Y = Convert.ToDouble(Flower3.GetValue(Canvas.TopProperty));
Flower3.SetValue(Canvas.LeftProperty, Shadow3.GetValue(Canvas.LeftProperty));
Flower3.SetValue(Canvas.TopProperty, Shadow3.GetValue(Canvas.TopProperty));
}
private void Flower3_MouseUp(object sender, MouseButtonEventArgs e)
{
Flower3.ReleaseMouseCapture();
Flower3.SetValue(Canvas.LeftProperty, Origin3.X);
Flower3.SetValue(Canvas.TopProperty, Origin3.Y);
}
}
}