Svg.Controls.Avalonia exposes the same high-level Avalonia SVG concepts as the Skia-backed package, but renders through the Avalonia drawing stack instead of wrapping the Svg.Skia runtime object.
dotnet add package Svg.Controls.Avalonia
Svg, SvgImage, SvgSource, and SvgResource concepts,SKSvg, control-coordinate hit testing, zoom, or wireframe features.| Type | Role |
|---|---|
Avalonia.Svg.Svg |
Control that renders SVG through Avalonia drawing commands |
Avalonia.Svg.SvgImage |
IImage wrapper for a reusable SvgSource |
Avalonia.Svg.SvgSource |
Reusable source object backed by the intermediate picture model |
SvgImageExtension |
Markup extension for concise image usage |
SvgResourceExtension |
Brush-producing markup extension |
<Window
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:svg="clr-namespace:Avalonia.Svg;assembly=Svg.Controls.Avalonia">
<DockPanel>
<svg:Svg Path="/Assets/__tiger.svg" Stretch="Uniform" />
</DockPanel>
</Window>
For image properties:
<Image Source="{SvgImage /Assets/__AJ_Digital_Camera.svg}" />
using System;
using Avalonia.Svg;
using Svg.Model;
var source = SvgSource.Load(
"avares://MyApp/Assets/icon.svg",
new Uri("avares://MyApp/"),
new SvgParameters(null, ".accent { fill: #007ACC; }"));
var image = new SvgImage
{
Source = source
};
var clone = source.Clone();
The package can load from file paths, HTTP URLs, Avalonia resources, and streams. SvgSource.RebuildFromModel() refreshes the stored intermediate picture after model-side changes.
This package uses an AvaloniaPicture recording and replay path rather than exposing SkiaSharp.SKPicture and SKSvg directly.
Choose this package when that difference is a feature, not a limitation:
SKSvg access,Choose Svg.Controls.Skia.Avalonia instead when you need:
SkSvg,Svg.Skia runtime object.The same SvgResource pattern is available here:
<Border Background="{SvgResource /Assets/__tiger.svg}" />
That lets you centralize SVG-backed brushes in resource dictionaries even when the main renderer is the Avalonia drawing stack.