using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Shapes; namespace Tango.Graphics2D { public class Drawing2DCanvas : Drawing2DHost { public override Point GetElementLocation(FrameworkElement element) { return GetElementCanvasLocation(element); } private Point GetElementCanvasLocation(UIElement element) { var location = new Point(Canvas.GetLeft(element), Canvas.GetTop(element)); if (double.IsNaN(location.X)) { location.X = 0; } if (double.IsNaN(location.Y)) { location.Y = 0; } return location; } public override Size GetElementSize(FrameworkElement element) { return new Size(element.Width, element.Height); } } }