Avalonia 載入/顯示 GIF 圖片
Avalonia 載入/顯示 GIF 圖片
資料來源: https://www.nuget.org/packages/AnimatedImage.Avalonia/
01.在專案目錄(有 .csproj檔案) 開啟『命令提示字元』 ~ 命令模式安裝nuget元件
dotnet add package AnimatedImage.Avalonia --version 1.0.7
02.XAML使用
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:anim="https://github.com/whistyun/AnimatedImage.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="VPOS_Avalonia.WaitAuthorization"
Title="WaitAuthorization" Loaded="Window_Loaded">
<!--
使用GIF備註
▲ 在專案目錄(有 .csproj檔案) 開啟『命令提示字元』; dotnet add package AnimatedImage.Avalonia ~~version 1.0.7 (實際執行 把~ 換成 -)
▲ Window 標籤; xmlns:anim="https://github.com/whistyun/AnimatedImage.Avalonia"
▲ 元件使用; <Image Grid.Row="1" Grid.Column="0" Width="95" anim:ImageBehavior.AnimatedSource="avares://VPOS_Avalonia/Assets/wait00.gif"/>
-->
<Border x:Name="FullBorder" BorderBrush="LightBlue" BorderThickness="5" CornerRadius="10" Margin="-3">
<Grid x:Name="FristGrid" RowDefinitions="15,*,15, *" ColumnDefinitions="100,*" >
<!-- 4列,2行 -->
<Image Grid.Row="1" Grid.Column="0" Width="95" anim:ImageBehavior.AnimatedSource="avares://VPOS_Avalonia/Assets/wait00.gif"/>
<TextBlock x:Name="Msg" Text="等待註冊授權中(60)秒" FontSize="26" Foreground="White" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" />
<Button x:Name="Close" Click="Close_Clicked" FontSize="22" Grid.Row="3" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Margin="10,0" Background="#ff9909" Foreground="White" Content="取消註冊" />
</Grid>
</Border>
</Window>