<Window x:Class="WpfMoveRectangles.MainWindow"
        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"
        xmlns:local="clr-namespace:WpfMoveRectangles"
        mc:Ignorable="d"
        Title="WpfMoveRectangles"
        Height="250" Width="350"
        Loaded="Window_Loaded">
    <Canvas Name="dragCanvas" Background="Transparent"
        MouseDown="dragCanvas_MouseDown" MouseMove="dragCanvas_MouseMove" MouseUp="dragCanvas_MouseUp">
        <Border BorderBrush="LightBlue" BorderThickness="5"
            Canvas.Left="50" Canvas.Top="30" Height="150" Width="250"/>
        <Rectangle Name="rectangle1" Stroke="Black"
            Canvas.Left="20" Canvas.Top="40" Width="114" Height="81">
            <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <LinearGradientBrush.GradientStops>
                        <GradientStop Color="White" Offset="0"/>
                        <GradientStop Color="Red" Offset="1"/>
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Rectangle Canvas.Left="81" Canvas.Top="78" Height="81" Name="rectangle2" Stroke="Black" Width="114">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="White" Offset="0" />
                    <GradientStop Color="Green" Offset="1" />
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Rectangle Canvas.Left="147" Canvas.Top="119" Height="81" Name="rectangle3" Stroke="Black" Width="114">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="White" Offset="0" />
                    <GradientStop Color="Blue" Offset="1" />
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
    </Canvas>
</Window>
