How can we improve the Windows dev platform?

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).
 We used this extensively in one javascript project but would have preferred to do this in XAML
- 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
- I would not expect to use javascript/css classes to manipulate SVG from a XAML app but bonus points if XAML styles could be plugged in
- 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?)

348 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Oren Novotny shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Zach Dowd commented  ·   ·  Flag as inappropriate

    To use SVG at the moment there are two options, display in a web browser (which can't have a transparent background), or convert the file to canvas which loses a lot of quality. I would like to be able to use an SVG file as the source for an image.

  • Trillian commented  ·   ·  Flag as inappropriate

    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.

2 Next →

Feedback and Knowledge Base