How can you align a canvas background in WPF?
10,416
Will this work? (It worked for me, anyway.)
<Canvas>
<Canvas.Background>
<ImageBrush ImageSource="someimage.jpg" AlignmentX="Right"
AlignmentY="Bottom" Stretch="None" />
</Canvas.Background>
</Canvas>
Comments
-
Totty almost 2 years
I have set a canvas' background to an image of a company logo. I would like for this image to be aligned to the bottom right corner of the canvas.
Is it possible to do this, or would it require for the image to be added into the canvas as a child? That would not work with this program as all children of the canvas are handled differently.Thank You
-
Totty over 15 yearsWell, yes and no. The solution I am looking for would alter the Canvas.Background image to be positioned differently. Not a child of the canvas. Also, I believe the easier way to handle the child as you describe would be to set the Canvas.Bottom and Canvas.Right to 0. No need to update then.
-
Totty over 15 yearsExactly what I needed. I looked through all the properties for ImageBrush, but somehow I missed those. Thanks!