I have a WPF user control that contains a Canvas control, and on that control I want to tile an image that is the same height as the control, but not as wide. I've managed to do it with this code:
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.BaseDirectory + "\\res\\01.PNG"));
brush.TileMode = TileMode.Tile;
brush.ViewportUnits = BrushMappingMode.Absolute;
brush.Viewport = new Rect(0, 0, brush.ImageSource.Width, brush.ImageSource.Height);
brush.Stretch = Stretch.None;
bkgCanvas.Background = brush;
But, when I run this, the image is zoomed in a small amount, so that it is bigger than it's actual size. I need it to display at actual size with no zoom.