0

I am using SharpVectors to display SVG images in my WPF project.

One way to do this is to specify the SvgImage markup extension for the image source, such as:

<Image Source="{svgc:SvgImage Source=Images/test.svg}"/>

This works great at runtime.

However at design-time the image shows up blank. Is there any way to specify a design-time-only image? Ideally it would be the same image used at runtime, but even an alternative placeholder image would be better than nothing. That way at least the relative positions of objects would be clear, etc.


Note - although there are other ways of displaying an SVG image (namely, the SvgViewBox object) there are cases where you can only do it by specifying an image source. Namely, the LargeImageSource or SmallImageSource attributes of WPF Ribbon controls.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
  • At which control you want it to show up? As `Window`/`UserControl` background? – FredM Apr 26 '19 at 09:15
  • Did you tried playing around with `xmlns:d="http://schemas.microsoft.com/expression/blend/2008"`, then `d:DesignStyle="..."` and setting someting there? – FredM Apr 26 '19 at 09:16
  • @FredM I haven't actually... I'm familiar with how to use DesignStyle for a bound property, but in this case the image is specified statically in XAML. But that could be a worthwhile alternative, maybe. Thanks – StayOnTarget Apr 26 '19 at 11:49

1 Answers1

0

Providing the same answer here just for the records!

Please try using the newly added property; AppName, which is used to try and resolve the URI of the resource file at design-time. See the samples for the SvgImage and newly added SvgImageConverter, especially the toolbar demo using the SVG icons.

https://github.com/ElinamLLC/SharpVectors/tree/master/TutorialSamples/ControlSamplesWpf

SvgImageConverter provides binding support, if you need it unlike the SvgImage.

PaulusHub
  • 385
  • 1
  • 4
  • 17