Search code examples
windows-phone-7windows-phone-7.1windows-phone-8windows-phone-7.1.1

how to write text on a image using windows phone code?


Possible Duplicate:
Write text on image in WP7

I have an app and one of the feature I want to add to it is , sending the picture with some text on top of it.IS that possible to code this in windows phone ?


Solution

  • Easy way is just rendering a TextBlock with the text on a WriteableBitmap

    private void RenderString(WriteableBitmap bitmap, string stringToRender)
    {
        TextBlock textBlock = new TextBlock();
        textBlock.Text = stringToRender;
    
        // set font, size, etc. on textBlock
    
        bitmap.Render(textBlock, null);
        bitmap.Invalidate();
    }