Using XAML vector graphics in WPF application
-
06-07-2019 - |
Question
I have a vector image that I've defined in XAML. What is the proper way to use this resource in a WPF application?
I want to have the vector image in its own XAML file, and then add the image to other UserControls in my application. What should be the top-level element in my XAML vector image? How do I refer to that image in other UserControls?
Solution
http://learnwpf.com/post/2006/06/04/How-do-I-Include-Vector-Based-Image-Resources-in-my-WPF-Application.aspx explains how to do it.
<ContentControl Template="{StaticResource Credit-Card}" />
OTHER TIPS
It is extremely difficult to use vector graphics in a reusable way in WPF and Silverlight.
These two StackOverflow questions discuss some of the options available:
WPF What is the correct way of using SVG files as icons in WPF
After reading through these questions and answers, I think the best solution is to stick with with a bitmap/raster format like PNG until Microsoft decides to support SVG.