-1

Setup

I have a project in WPF that I plan on having a sidebar for. Of course the selected button in the sidebar is supposed to have a different style than the non-selected ones.

For the design I developed, the button background changes from transparent to blue and the buttons icon from black to white.

What I have found out

I know I could just have two different .png files that I swap out in the code behind, however I am trying to implement a cleaner solution such as found in this video (timestamp 3:10). A custom control that I can just reuse for all sidebar navbuttons and, as shown in the video at around 9:30, change the Icon color on hover using XAML.


Problem

I have all icons from my design in .svg files. How do I get them into a format where I can plug them into my XAML code as shown in the video or what are similar approaches to achieve a color changing icon onMouseOver and onSelected?

Jannes
  • 225
  • 1
  • 10
  • For iconography, I would use geometries. Same syntax as inside svg. For a single colour icon you can use a path and change it's fill brush using a trigger. Multiple colours for various shapes in an icon are a bit more fiddly. Do you need that? – Andy Aug 27 '23 at 11:04
  • "SvgToXaml" converter, which converts SVG files to XAML format. – wenbingeng-MSFT Aug 28 '23 at 11:52

0 Answers0