public override void Render(DrawingContext context) { base.Render(context); var scaleX = Width / PATTERN_WIDTH; var scaleY = Height / PATTERN_HEIGHT; for (var y = 0; y < PATTERN_HEIGHT; y++) { for (var x = 0; x < PATTERN_WIDTH; x++) { context.FillRectangle(new SolidColorBrush(Pattern.GetPixelArgb(x, y)), new Rect(x * scaleX, y * scaleY, scaleX, scaleY)); } } }