creating and saving an image in Windows Store apps with C#


  • I need to draw a few geometric shapes and text  into a container, maybe a canvas container. 

    When the user likes what he/she sees, then I want to ge able to save the contents of this containers to an image file.

    Is this possible?  if it is, how can it be achieved?



    Thursday, March 13, 2014 6:01 PM


All replies

  • Please see WriteableBitmap, specifically the Render() method:

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, March 13, 2014 7:32 PM
  • Minor correction. Matt's thinking Windows Phone. For a Windows Store app you want RenderTargetBitmap to render a visual tree into a bitmap.
    Thursday, March 13, 2014 9:24 PM
  • Since you want the user to be able to manipulate the objects, you could go with annotations, which can be edited then "burned" or realized on the image before saving. One way to do it is to use the Leadtools library which has Windows Store classes for editing and burning annotations and also supports saving images. To find the class, bing or google "AnnWinRTRenderingEngine"
    Thursday, March 13, 2014 9:30 PM