2016-12-19 59 views

回答

1

是否有使用Xamarin的UWP/Win10應用程序的自定義循環活動指示器?

您需要創建自己的UWP的ProgressRingView

共享項目\ MyProgressRing.cs:

public class MyProgressRing:View 
{ 
} 

UWP項目\ 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。