简体   繁体   中英

How do I control clipping in C# or XAML when using UniformToFill with an image

I have an image control in a resizable window with its stretch property set to UniformToFill .

<Image Name="some_image" Stretch="UniformToFill" Margin="0,0,0,0" />

The clipping window is pegged to the top left of the image; resizing chops off the right and bottom of the image.

I want the image to be clipped equally on all sides. Am I being dense and overlooking an obvious solution?

How do I control how the image gets clipped?

(Unrelated: This is my first post to stackoverflow. I just wanted to start off saying, thanks, this site has been amazing resource for me)

The HorizontalAlignment and VerticalAlignment property determine this behavior with an image control.

 <Image Name="some_image" Stretch="UniformToFill" Margin="0,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" />

Guess i was being dense!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM