Draw a string on a picture on WP

I want to draw a string on a picture from the library on Windows Phone. To get the picture I'm using the PhotoChooserTask. After getting the picture I want to write a text of a textbox on this image and save the image to the library.

WriteableBitmap wbmps = new WriteableBitmap(480, 800);
wbmps.SetSource(e.ChosenPhoto);

ScaleTransform transform = new ScaleTransform();
transform.ScaleX = 1;
transform.ScaleY = 1;

wbmps.Render(backgroundPic, transform);
wbmps.Render(diaText, transform);

wbmps.Invalidate();

backgroundPic.Source = wbmps;

But this do not that what I want. So how can I fix it and write something on the image. After this I want to make a colored rectangle around the text, but I don't know how to do this.

Upvotes: 0

Views: 538

Answers (1)

thumbmunkeys
thumbmunkeys

Reputation: 20764

put your elements in a Grid and then render the Grid:

      <Grid x:Key="TheGrid">
        <Image.../>
        <Border ...>
           <TexBlock .../>
        </Border>
      <Grid>

code:

    wbmps.Render(TheGrid, transform);

Upvotes: 1

Related Questions