Creating an image from UIElement covered in another matter . However, I am trying to make a UIElement image in which an unfilled background remains transparent. This is currently being done in my code ( DOES NOT work for transparency):
var imageBrush_Final = new ImageBrush { ImageSource = bi, Stretch = Stretch.None }; FinalCanvas.Background.Opacity = 0; FindChildShieldCanvas_FinalCanvas(FinalCanvas, imageBrush_Final); FinalCanvas.InvalidateArrange(); FinalCanvas.UpdateLayout(); WriteableBitmap writeableBitmap_Finals = new WriteableBitmap(FinalCanvas, null); String tempPNG = results.Username + "My_Crest.png"; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream imageStream = new IsolatedStorageFileStream(tempPNG, System.IO.FileMode.OpenOrCreate, isf)) { await Cimbalino.Toolkit.Extensions.WriteableBitmapExtensions.SavePngAsync(writeableBitmap_Finals, imageStream); } }
Created an image from canvas , inside which one form was added. The form is filled with ImageBrush , in particular imageBrush_Final . The canvas is partially filled by the artist of the internal form, which was painted by imageBrush_Final . Therefore, I would like the created writeableBitmap_Finals be filled only with the form, and the rest should be completely transparent.
Does anyone know how I can achieve this, and why it is not saved when a UIElement , i.e. canvas set its background on Opacity to 0 ?
Jtim
source share