Xaml 使用Xamarin格式的SVG图像

Xaml 使用Xamarin格式的SVG图像,xaml,xamarin,svg,xamarin.forms,Xaml,Xamarin,Svg,Xamarin.forms,我使用的是nugget包SVG.Forms.Plugin.Abstractions,我从一个简单的示例中复制了下面的XAML,但无法显示SVG 该映像位于“TestApp”应用程序的“images”文件夹中,其构建操作为“Embedded Resource”SvgAssebly绑定到viewModel中下面的公共程序集 我得到的只是一个顶部有标题文本的空白屏幕。 有人能看出什么明显的错误吗 public Assembly SvgAssembly { get { return typ

我使用的是nugget包
SVG.Forms.Plugin.Abstractions
,我从一个简单的示例中复制了下面的XAML,但无法显示SVG

该映像位于“TestApp”应用程序的“images”文件夹中,其构建操作为“Embedded Resource”
SvgAssebly
绑定到viewModel中下面的公共程序集

我得到的只是一个顶部有标题文本的空白屏幕。
有人能看出什么明显的错误吗

public Assembly SvgAssembly
{
       get { return typeof(App).GetTypeInfo().Assembly; }
}
XAML:


请注意:

  • 从装订中删除间距:

    SvgAssembly=“{Binding SvgAssembly}”

  • 您应该像这样引用图像:

    SvgPath=“brand.SVG”

  • 您需要确保正确引用图像:
    我对另一个问题的回答

    尝试使用FFImageLoading,因为它可以选择使用SVG图像。它还可以选择在用户设备上缓存图像。请参阅以下文档:


    您关注的是什么设备平台?
    <?xml version="1.0" encoding="utf-8"?>
    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
                 x:Class="TestApp.MainPage" 
                 xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared" 
                 xmlns:local="clr-namespace:TestApp;assembly=TestApp" Title="{ artina:Translate PageTitle}" BackgroundColor="{DynamicResource BasePageColor}"
                 xmlns:abstractions="clr-namespace:SVG.Forms.Plugin.Abstractions;assembly=SVG.Forms.Plugin.Abstractions">
    
        <ContentPage.Content>
    
            <StackLayout>
                <abstractions:SvgImage
                    SvgAssembly="{Binding SvgAssembly }"
                    SvgPath="TestApp.images.brand.svg"
                    Width="200"
                    Height="200" />
            </StackLayout>
        </ContentPage.Content>
    </ContentPage>