Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Phone generating Tile - cant seem to make it transparent
    text
    copied!<p>I am generating a tile from within my application and when its displayed the background image that its using as the basis fro the the tile has lost its transparency (and therefore its not picking up the theme color.</p> <p>The background image has an icon on it and is transparent - when I use it as the standard Tile (i.e. not generate an image with it ) thens its fine and the transparency is all good..</p> <p>But when I use it as the background image and add my own container over it then its not transparent the background is showing as black.</p> <p>The relevant code is as follows:</p> <pre><code> // [...] var container = new Grid(); if (isWide) { container = CreateContainerWide(tileInfo); } else { container = CreateContainerMedium(tileInfo); } // Add the background container.Background = new ImageBrush { ImageSource = background, Opacity = opacity }; // Force the container to render itself container.Arrange(new Rect(0, 0, width, height)); // Write the image to disk and return the filename return WriteShellTileUIElementToDisk(container, baseFileName); } static string WriteShellTileUIElementToDisk(UIElement element, string baseFileName) { var wb = new WriteableBitmap(element, null); // All content must be in this sub-folder of IsoStore string fileName = SharedImagePath + baseFileName + ImageExtension; var stream = new IsolatedStorageFileStream(fileName, System.IO.FileMode.Create, Isf); // Write the JPEG using the standard tile size // Sometimes the bitmap has (0,0) size and this fails for unknown reasons with an argument exception if (wb.PixelHeight &gt; 0) wb.SaveJpeg(stream, wb.PixelWidth, wb.PixelHeight, 0, JpegQuality); else { Debug.WriteLine("Can't write out file because bitmap had 0,0 size; not sure why"); // indicate that there is an issue fileName = null; } stream.Close(); // Return the filename return fileName; } </code></pre> <p>Doesn't seem to make any difference as to what I set the Opacity of the ImageBrush to.</p> <p>If I used a solid color rataher than a transparent layer then its all fine. Somehow the creation of the png is losing the transparency.</p> <p>Any Ideas?</p> <ul> <li>thanks</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload