private Border ElemInBorder(IObject element) { var brdr = new Border { BorderBrush = Brushes.Black, BorderThickness = new Thickness(0), Margin = new Thickness(1, 3, 2, 3), Width = 110, Height = 110/1.666667 }; var uiElem = element as UIElement; if (uiElem == null) return null; IObject copy = element.DeepCopy(); copy.HorizontalAlignment = HorizontalAlignment.Center; copy.VerticalAlignment = VerticalAlignment.Center; if (copy.Height > copy.Width) copy.Height = brdr.Height - 10; else copy.Width = brdr.Width - 15; brdr.Child = copy as UIElement; return brdr; }