Tag: live tile

动态LiveTile – 添加背景图像?

在我的Windows Phone 7应用程序中使用活动磁贴工作,它工作得很好。 我现在正在尝试创建一个动态的实时图块,但我无法显示背景图像。 使用下面的代码时,我只得到一个黑色的瓷砖。 我添加的文字显示但不是背景图片。 图像“构建操作”设置为“内容”。 有任何想法吗? StackPanel sp = new StackPanel(); sp.Height = 173; sp.Width = 173; string fileName = “tile.jpg”; BitmapImage image = new BitmapImage(new Uri(fileName, UriKind.Relative)); ImageBrush brush = new ImageBrush(); brush.ImageSource = image; sp.Background = brush; sp.Measure(new Size(173, 173)); sp.Arrange(new Rect(0, 0, 173, 173)); sp.UpdateLayout(); WriteableBitmap wbm = new WriteableBitmap(173, […]

WriteableBitmap内存泄漏?

我正在使用下面的代码创建一个基于UI元素的实时图块。 它在WriteableBitmap上呈现uiElement ,保存位图+返回文件名。 此方法在Windows Phone后台任务代理中运行,我正在运行内存限制。 private string CreateLiveTileImage(Canvas uiElement, int width, int heigth) { var wbmp = new WriteableBitmap(width, heigth); try { wbmp.Render(uiElement, null); wbmp.Invalidate(); var tileImageName = _liveTileStoreLocation; using (var stream = new IsolatedStorageFileStream(tileImageName, FileMode.Create, FileAccess.Write, IsolatedStorageFile.GetUserStoreForApplication())) { wbmp.SaveJpeg(stream, width, heigth, 0, 100); stream.Close(); } uiElement = null; wbmp = null; GC.Collect(); return “isostore:” […]