林在我的Windows手机应用程序的辅助动态磁贴经历与背景图像的问题,它不伸展,适当地配合区块(它是一个PNG图片)的Windows Phone动态磁贴和backgroundImage源和拉伸问题
我得到的数据,然后创建我的瓦片数据:
var tileData = new StandardTileData
{
Title = titleString,
BackContent = contentString,
BackTitle = backTitleString,
BackgroundImage = new Uri(httpUrlString)
};
有没有办法改变拉伸或“retemplate”瓦?
此外,我找到了解决办法here用WriteableBitmap的,但我不知道如何给这个位图作为源,因为BackgroundImage属性只接受一个URI
谢谢您的回答!不幸的是,我仍然没有解决我的问题,我尝试调整这种方式,并创建writeablebitmap.then时,我得到例外,我试过这个BitmapImage bitmapImage = new BitmapImage(new Uri(img)); Image image = new Image(); image.Width = 173; image.Height = 173; image.Stretch = Stretch.UniformToFill; image.Source = bitmapImage; WriteableBitmap writeableBitmap = new WriteableBitmap(image,null);然后按照你的建议保存它,但是现在我的瓷砖上的图像是黑色的 – user970012
原始图像的大小是多少?你会得到什么例外? –
图像来自网络来源,例如150 x 106像素也是PNG格式,我不知道这是否相关。例外情况是nullreferenceexception,writeablebitmap创建的无效指针 – user970012