Is it possible to add text to writeablebitmap in metro style app

Apr 16, 2013 at 4:12 AM
Hi
I just want to add text to the writeablebitmap and save to .png files,
So I referenced the below discussion thread
Is it possible to add text to bitmap?
public static void DrawText(this WriteableBitmap wBmp,Point at, string text,double fontSize,Color textColor)
    {        
        TextBlock lbl = new TextBlock();
        lbl.Text = text;
        lbl.FontSize = fontSize;
        lbl.Foreground = new SolidColorBrush(textColor);
        WriteableBitmap tBmp = new WriteableBitmap(lbl, null);
        wBmp.Blit(at, tBmp, new Rect(0, 0, tBmp.PixelWidth, tBmp.PixelHeight), Colors.White, System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode.Alpha);
    }
But this way seems like can't be used in metro style app ....
Coordinator
Apr 16, 2013 at 11:07 AM
Indeed, WinRT does not allow rendering of the Visual Tree. :( But that might change in the next version. In the meantime you can use blitting with bitmap fonts.
Coordinator
Feb 2, 2015 at 8:55 AM
This might help [discussion:579148]