Ankit Prajapati
Ankit Prajapati

Reputation: 21

Xamarin.UWP : How to make circular Progress Bar

I have created Xamarin Form App. Now I want to use circular progress bar in UWP App. now I found Progress Bar as vertical line.

So How to make Progress Bar in Circular design???

Upvotes: 0

Views: 900

Answers (2)

mindOfAi
mindOfAi

Reputation: 4632

I think what you're looking is the UWP's ProgressRing. You would need to use a Custom Renderer for that.

CustomRenderer

[assembly:ExportRenderer(typeof(CustomProgressRing),typeof(CustomProgressRingRenderer))]
namespace CustomProgressRingDemo.UWP
{
    public class MyProgressRingRenderer:ViewRenderer<CustomProgressRing,ProgressRing>
    {
        ProgressRing ring;
        protected override void OnElementChanged(ElementChangedEventArgs<CustomProgressRing> 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);
            }
        }
    }
}

And then create a class that inherits the View class.

CustomProgressRing.cs

public class CustomProgressRing:View
{
}

Hope it helps!

Upvotes: 1

lindexi
lindexi

Reputation: 4357

See: http://xamlnative.com/2016/04/14/xamarin-forms-a-simple-circular-progress-control/

If want to see the version that translate to Chinese ,please see:http://blog.csdn.net/lindexi_gd/article/details/51274339

Upvotes: 0

Related Questions