Support SVG elements in XAML
The high-level ask is to support using SVG within a XAML tree. The SVG data may be inline or loaded from a source (local file or remote from the web)
There are few current tools for converting SVG to WPF/Silverlight-based XAML but they fall short when dealing with more complex SVG data.
Here are a few scenarios:
- Apps loading svg content from a remote web server. This should work just like any other kind of image data. Remote xaml isn’t likely allowed, and even if it were, there’d be resistance to providing vector art in two formats when SVG is a standard.
o Some SVG files may be dynamically generated by a remote server
- SVG data loaded in a XAML view may have internal named elements.
o I would imagine that there’d be a way to access the internal elements from code to manipulate them and attach event handlers (hover/touch, etc), change properties (color, opacity, etc).
- There’s a lot of free source SVG files that usable under creative commons on Wikipedia for things like US maps, electoral districts and many other rich features.
o It’s a huge time saver to piggyback on those assets. For example, suppose you wanted to color a US map by probability of each electoral district voting a certain way. This is easily done with some reference data & SVG from Wikipedia. Problem is there’s no way to easily manipulate this within a XAML app
- I would hope that an SVG-renderer element would use similar hardware acceleration that the HTML5 renderers use
- Manual conversion to XAML is an extra step in the workflow and leads to duplication of assets. A designer may keep tweaking the source image and must keep generating that XAML. That xaml would then need to be copied into a resource dictionary and can’t be a separate file resource (can it?)
This is done and now is in Windows 10 Creators Update
XAML is built from the ground up to support intelligent layouts that make the best use of the available space. Controls are themed using vector graphics to be seamlessly scalable.
However, using vector images is a real pain as they are really treated as a second-class citizen. There is no easy way to have a folder full of vector image files and display them by simply data binding the Image.Source property. There are some workarounds, but they are overly complex when this should be a supported (and encouraged!) scenario. It should be easy for a developer to transition from fixed-size raster images to scalable vector images by simply changing a path in the application.
What we need is support for some vector graphics format in Image controls. Ideally SVG, as it's quite the norm now, but images defined from XAML shapes in separate documents could also do the work.