/// <summary>
        /// Update the bounding rectangle with the most recent touch device info. If a
        /// rectangle has not been created yet, create one.
        /// </summary>
        /// <param name="touchDevice">the touch device to diagram</param>
        /// <param name="showBoundingRectangle">Whether or not the rectangle should be shown</param>
        private void UpdateRectangle(TouchDevice touchDevice, bool showBoundingRectangle)
        {
            // Create an rectangle if one does not exist already.
            if(boundingRectangle == null)
            {
                // Make a new Rectangle
                boundingRectangle = new Rectangle();
                 
                // Give the rectangle a fill.
                boundingRectangle.Fill = new SolidColorBrush(Color.FromArgb(0xFF, 0xE6, 0xE6, 0xE6));

                // Add the rectangle to the MainCanvas.
                MainCanvas.Children.Add(boundingRectangle);

                // Give the rectangle a lower ZIndex than everything else on the main canvas
                // so it is not drawn on top of anything else
                Canvas.SetZIndex(boundingRectangle, int.MinValue );
            }

            // Get the bounding rect for the touchDevice
            Rect touchDeviceRect = touchDevice.GetBounds(this);
            Rect bounds = new Rect(touchDeviceRect.X, touchDeviceRect.Y, touchDeviceRect.Width, touchDeviceRect.Height);

            // Update the properties of boundingRectangle
            boundingRectangle.Height = bounds.Height;
            boundingRectangle.Width = bounds.Width;
            Canvas.SetLeft(boundingRectangle, bounds.Left);
            Canvas.SetTop(boundingRectangle, bounds.Top);

            // Hide the rectangle if the user does not want to view bounding rectangles
            boundingRectangle.Visibility = showBoundingRectangle ? Visibility.Visible : Visibility.Hidden;
        }