所以使用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
所以我的问题是如何让ActualHeight和ActualWidth始终等于高度和宽度?另外,为什么图像1看起来不会放在画布上的0,0上?
答案 0 :(得分:1)
为了确保ActualWidth
和ActualHeight
等于Width
和Height
(假设它们实际已设置),您应该设置图像&#39 ; Stretch
属性为Fill
:
<Image ... Width="50" Height="50" Stretch="Fill"/>