Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Jul 24, 2022
1 parent f5ced19 commit b254cf1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Expand Up @@ -194,6 +194,28 @@ Install-Package Avalonia.Svg.Skia
<Image Source="{SvgImage /Assets/__AJ_Digital_Camera.svg}"/>
```

#### Avalonia Previewer

To make controls work with `Avalonia Previewer` please add the following lines to `BuildAvaloniaApp()` method:
```C#
GC.KeepAlive(typeof(SvgImageExtension).Assembly);
GC.KeepAlive(typeof(Avalonia.Svg.Skia.Svg).Assembly);
```

The `BuildAvaloniaApp()` should look similar to this:
```C#
public static AppBuilder BuildAvaloniaApp()
{
GC.KeepAlive(typeof(SvgImageExtension).Assembly);
GC.KeepAlive(typeof(Avalonia.Svg.Skia.Svg).Assembly);
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
```

This is know issue as previewer not always loads all dependencies, especially custom controls in Avalonia xmlns, other solution would be to add xmlns prefix to control with provided assembly path.

### Tool

```
Expand Down

0 comments on commit b254cf1

Please sign in to comment.