UWP 的 Xamarin 循环 activity 指标

Xamarin circular activity indicator for UWP

是否有针对使用 Xamarin 的 UWP/Win10 应用程序的自定义通告 activity 指示器?

Is there a custom circular activity indicator for UWP/ Win10 apps using Xamarin?

您需要为 UWP ProgressRing 创建自己的 View

共享 Project\MyProgressRing.cs:

public class MyProgressRing:View
{
}

UWP Project\MyProgressRingRenderer.cs:

[assembly:ExportRenderer(typeof(MyProgressRing),typeof(MyProgressRingRenderer))]
namespace CircularActivityDemo.UWP
{
    public class MyProgressRingRenderer:ViewRenderer<MyProgressRing,ProgressRing>
    {
        ProgressRing ring;
        protected override void OnElementChanged(ElementChangedEventArgs<MyProgressRing> e)
        {
            base.OnElementChanged(e);
            if (Control == null)
            {
                ring = new ProgressRing();
                ring.IsActive = true;
                ring.Visibility = Windows.UI.Xaml.Visibility.Visible;
                ring.IsEnabled = true;
                SetNativeControl(ring);
            }
        }
    }
}

注意:我对 ProgressRing 控件的属性进行了硬编码。您可以为自定义 ProgressRing 控件创建 DependencyProperties。