5

I'm working at a Windows 8 Metro Application with XAML and C#

I have got a Uri to a SVG Image, which really works, but I have no Idea how to get this Image and display it in the XAML.

Or is it impossible to work with SVG în .NET Core?

SwissPrime
  • 443
  • 1
  • 6
  • 10
  • How about loading it into a Webview, where you can use an element in the HTML with the src attribute set to your SVG? If it's in your package you should be able to use ms-appx-web:/// to refer to it. – Kraig Brockschmidt - MSFT Dec 08 '13 at 22:56

2 Answers2

3

One way could be to convert the SVG to XAML paths - which you can display in any XAML view/control. I use this approach to show vector icons in my app. Do a quick search for SVG to(http://benpittoors.wordpress.com/2009/03/17/convert-svg-to-xaml/)

Krishna
  • 2,997
  • 1
  • 23
  • 31
  • Great post! Unfortunately I was able to make it running only under IE10. In Opera XPS printer did output jpgs – SOReader Nov 22 '13 at 10:51
  • Another great way to convert from SVG to XAML is using Inkscape. However there are limitations, like Metro app can not use RadialGradientBrush. – Zéiksz Jan 15 '14 at 11:55
  • It's much faster to use this app: https://github.com/BerndK/SvgToXaml It can convert single files and also all svgs in a folder (batch) – BerndK May 07 '15 at 19:03
1

Or is it impossible to work with SVG în .NET Core?

The .NET Metro Profile is NOT the .NET 4.5 Full Profile or even the .NET Client Profile. One of the requirements or limitations of the Metro application is the inability to link to any content not compiled with Metro Profile.

I suggest you use WPF instead.

Krishna
  • 2,997
  • 1
  • 23
  • 31
Security Hound
  • 2,577
  • 3
  • 25
  • 42
  • I think you may be mistaken. The .NETCore profile *is* the so-called Metro profile. The .NET 4.5 Full Profile is just that - a full set of .NET libraries available on the Windows desktop platform. It is just unfortunate naming by Microsoft. (see: search for the word .NETCore in http://blog.stephencleary.com/2012/05/framework-profiles-in-net.html – Krishna Nov 23 '13 at 04:02
  • @Krishna - I am not mistaken. You CANNOT target the full .NET Framework and publish an application to the Windows Store. – Security Hound Nov 23 '13 at 19:27
  • 1
    Correct. You can't target the full .NET fx and publish to the Windows store. But I was referring to the other statement: the 'full profile is not called '.NETCore'. '.NETCore' is the profile you use to create Windows store apps. – Krishna Nov 26 '13 at 02:50