saving canvas as image in metro style app with C#/XAML

后端 未结 4 935
半阙折子戏
半阙折子戏 2020-12-20 01:55

I am developing a paint like application in metro style with C#/XAML. I want to save whatever content is drawn on canvas as image. I have checked this solutions but it didn\

相关标签:
4条回答
  • 2020-12-20 02:35

    One workaround is to use Direct2D with DirectWrite. It is a bit involved, but I might make a library available at some point.

    0 讨论(0)
  • 2020-12-20 02:48

    The standard approach in other xaml frameworks such as Silverlight and WP7 was to use WriteableBitmap, however the version in WinRT doesn't have a constructor that takes a xaml element which leads me to believe that it's currently impossible against the latest API.

    Sorry I couldn't be more help/

    0 讨论(0)
  • 2020-12-20 02:50

    It seems it is currently not supported out of the box like we were used to do it with WPF:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/dd66c749-efed-4b55-a716-e0aa3a637d28

    While when doing HTML5/Javascript Metro apps you can do this:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/cf8c17dc-68d4-4777-951f-bb7f0665bd06

    0 讨论(0)
  • 2020-12-20 03:02

    The accepted answer from Sascha is no longer true for Windows 8.1. There is a new RenderTargetBitmap class that allows Rendered XAML to be converted to a bitmap.

    See: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.imaging.rendertargetbitmap.aspx

    However I can't seem to render that XAML is Collapsed or otherwise not currently on screen. Any help with that would be appreciated!

    0 讨论(0)
提交回复
热议问题