XAML 显示来自嵌入资源的图像

um6iljoc  于 2022-12-25  发布在  其他
关注(0)|答案(1)|浏览(198)

我需要在应用程序的主页上显示我们的应用程序徽标,但无论我做什么,都没有显示。

<Image 
            Source="{StaticResource 'MystronicsWinder.Resources.AppIcon.appicon.svg'}"
            Margin="20"
            Aspect="AspectFill"
            IsVisible="true"/>

    • 更新**:
<Image 
            Source="{StaticResource 'MystronicsWinder.Resources.AppIcon.appicon.png'}"
            Margin="20"
            Aspect="AspectFill"
            WidthRequest="300"
            HeightRequest="300"
            IsVisible="true"/>

我有同样的问题与我的png标志!

ioekq8ef

ioekq8ef1#

为了显示SVG图像,我使用我的库,您可以在这里找到:https://github.com/FreakyAli/Maui.FreakyControls
它使用Skia来显示SVG图像:https://github.com/FreakyAli/Maui.FreakyControls/wiki/FreakySvgImageView
要使用的所有SVG图像的生成操作都需要设置为EmbeddedResource。

<freakyControls:FreakySvgImageView
    Command="{Binding OnTapCommand}"
    CommandParameter="{Binding OnTapCommandParam}"
    Tapped="FreakySvgImageView_Tapped"
    SvgAssembly="{x:Static samples:Constants.SvgAssembly}"
    SvgMode="AspectFit"
    ResourceId="{x:Static samples:Constants.DotnetBot}"/>

祝你好运!

相关问题