Invalid XAML produced when gradient defined outside defs

I think it's AWESOME that InkScape saves as XAML, and I often see it recommended for such work.

When saving this SVG as XAML, the result needs some manual modifications to make it valid in a WPF Window.

Steps to reproduce:

Save the SVG as a XAML file. ![favicon-src2.svg]

Copy the ViewBox from the XAML to a WPF Window.

What happened?

WPF designer complained that the XAML is invalid because:

LinearGradientBrush is not inside resource dictionary, eg <Canvas.Resources> Duplicate x:Key used for brushes (this appeared after my manual fix to the XAML).

Eg.

<Canvas Name="layer1">
      <Canvas.RenderTransform>
        <TranslateTransform X="0" Y="-852.36225"/>
      </Canvas.RenderTransform>
      <Canvas Name="g5191" Opacity="0.71399997">
        <Canvas.RenderTransform>
          <MatrixTransform Matrix="1.2992849 0 0 1.1048786 23.192244 857.41524"/>
        </Canvas.RenderTransform>
        <LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient5047" MappingMode="Absolute" StartPoint="50,0" EndPoint="50,164">
          <LinearGradientBrush.GradientStops>

What should have happened?

Presumably there is an element missing in the XAML that should have wrapped the LinearGradientBrush.

Inkscape Version and Operating System:

  • Inkscape Version: 0.91 and 0.92
  • Operating System: Windows
  • Operating System version: 10

favicon-src2.svg favicon-src.xaml

Edited by Nathan Lee