简体   繁体   English

图片显示不正确

[英]image is not displaying properly

在此处输入图片说明 So using snoop I can see that the properties are as follows 因此,使用snoop我可以看到属性如下

Image 1
Height = 160
ActualHeight = 160
Width = 372
ActualWidth = 299.7468...
x = 0
y = 0

image 2
Height = 50
ActualHeight = 26.6891...
Width = 50
ActualWidth = 50 
x = 20
y = 20


Image 2
Height = 50
ActualHeight = 26.6891...
Width = 50
ActualWidth = 50 
x = 60
y = 60

So my questions is how do I get the ActualHeight and ActualWidth to always be equal to the Height and Width? 所以我的问题是如何使ActualHeight和ActualWidth始终等于Height和Width? Also why does image one not appear to be placed at 0,0 on the canvas? 另外,为什么图像一似乎没有放在画布上的0,0处?

为了确保ActualWidthActualHeight等于WidthHeight (假设它们是实际设置的),您应该将Image的Stretch属性设置为Fill

<Image ... Width="50" Height="50" Stretch="Fill"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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