在UWP中我有这个图像
<Image Source="{Binding Bitmap}" Stretch="Uniform"/>
我想在代码后面的Image元素中获得调整大小的Bitmap的大小,所以我有这个
Image img = ...;
var width = img.Width; // this gives size of Image element not the bitmap resized
// inside the Image.
因此原始位图的大小可能是1920x1080,但是图像元素大小是300x200,因此在给定Stretch=Uniform
的情况下,其中的位图大小为300x112.5。我想得到300x112.5
使用ActualWidth / ActualHeight属性。