private Border GenerateOutputVisual() { var g = new Border { Background = Brushes.White, BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, Child = PrepareInlineGraph() }; g.Width = Width; g.Height = Height; var size = new Size(Width, Height); g.Measure(size); g.Arrange(new Rect(size)); g.UpdateLayout(); return(g); }
void PasteImageAttachment() { Assert.IsNotNull(attachmentDialog); var border = new System.Windows.Controls.Border() { Width = 300, Height = 100, Background = Brushes.LightGreen, BorderBrush = Brushes.Green, BorderThickness = new Thickness(1) }; border.Child = new System.Windows.Shapes.Ellipse() { Width = 250, Height = 90, Fill = Brushes.ForestGreen, Margin = new Thickness(10) }; border.Arrange(new Rect(0, 0, 300, 100)); border.UpdateLayout(); RenderTargetBitmap bitmap = new RenderTargetBitmap(200, 200, 96, 96, PixelFormats.Pbgra32); bitmap.Render(border); Clipboard.SetImage(bitmap); attachmentDialog.ClickPaste(); // verify image exists var image = attachmentDialog.FindImage(); Assert.IsNotNull(image); }