【发布时间】:2011-08-06 11:20:33
【问题描述】:
我正在尝试将 Image 组件源设置为 BitmapImage:
然而,
Uri newUri = new Uri("images/" + filename, UriKind.Relative);
Image newImage = new Image();
BitmapImage bmp = new BitmapImage(newUri);
newImage.Source = bmp;
但是,如果图像小于屏幕,则会缩放以填充它。
我尝试设置宽度和高度如下:
newImage.Height = bmp.PixelHeight;
newImage.Width = bmp.PixelWidth;
但 BitmapImage 的宽度和高度返回零值。我想这是因为它还没有“加载”?
如何强制它为我提供正确的值或至少强制 Image 组件“换行”只适合位图的大小。
我所有的图片都是适合屏幕的像素尺寸。
谢谢
【问题讨论】:
标签: image windows-phone-7 size bitmapimage