4

Has anyone got some fool-proof settings for exporting SVG files from illustrator for WPF environment dev buttons?

Specifically, I'm being told by the developers the icons with a gradient are creating a URL reference within the doc, the syntax appears correct but it won't read the URL gradient reference or ignores it.

0

Short answer: You'll want convert svg to xaml files.

SVGs always reference a gradient by url. Even though its internal . Unlike CSS where you can specify a linear gradient as a property. SVGs reference an ID to an internal gradient fill="url(#Gradient)". You can't get around this.

<?xml version="1.0" standalone="no"?>
<svg width="120" height="120" version="1.1"
  xmlns="http://www.w3.org/2000/svg">
  <defs>
      <radialGradient id="Gradient"
            cx="0.5" cy="0.5" r="0.5" fx="0.25" fy="0.25">
        <stop offset="0%" stop-color="red"/>
        <stop offset="100%" stop-color="blue"/>
      </radialGradient>
  </defs>
  <rect x="10" y="10" rx="15" ry="15" width="100" height="100"
        fill="url(#Gradient)" />
  <circle cx="60" cy="60" r="50" fill="transparent" />
</svg>

.NET doesn't support SVGs very well (.NET being the Windows language used in WFP). There is a tool sharpvectors which should aid in making an SVG compatible in in .NET/WFP applications. Converting SVG into Windows custom format XAML.

It should also provide a GUI to view the graphic in a Windows/WFP environment. Offering some assurance that'll work before handing it to a Dev.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.