✅ How to use SVGs in XAML file (WPF)
I have a WPF project and I want to use an svg file in MainWindow.xaml. How do I properly use svg in xaml files? Do I need to convert it into something else?
4 Replies
I also want to be able to dynamically change its fill color like how i can using CSS
An article or tutorial would suffice
one thing you can do is attempt to convert the SVG into path geometry
this draws the following icon
![](https://utfs.io/f/9a4fc586-9f2b-4f40-8145-c9531f1a6c68-1nq2cb.png)
because unfortunately, WPF does not directly support SVGs
but if you just want a generic piece of vector graphics, a
Geometry
is pretty much what you wnt
the app I pulled that little example from has a shared UserControl
that I use to display a bunch of different geometry icons like that
there's a handful of other ways you can use a Geometry
to do interesting things