diff options
Diffstat (limited to 'Xamarin.Forms.Core/ProgressBar.cs')
-rw-r--r-- | Xamarin.Forms.Core/ProgressBar.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/ProgressBar.cs b/Xamarin.Forms.Core/ProgressBar.cs new file mode 100644 index 00000000..cd8addf6 --- /dev/null +++ b/Xamarin.Forms.Core/ProgressBar.cs @@ -0,0 +1,26 @@ +using System.Threading.Tasks; +using Xamarin.Forms.Platform; + +namespace Xamarin.Forms +{ + [RenderWith(typeof(_ProgressBarRenderer))] + public class ProgressBar : View + { + public static readonly BindableProperty ProgressProperty = BindableProperty.Create("Progress", typeof(double), typeof(ProgressBar), 0d, coerceValue: (bo, v) => ((double)v).Clamp(0, 1)); + + public double Progress + { + get { return (double)GetValue(ProgressProperty); } + set { SetValue(ProgressProperty, value); } + } + + public Task<bool> ProgressTo(double value, uint length, Easing easing) + { + var tcs = new TaskCompletionSource<bool>(); + + this.Animate("Progress", d => Progress = d, Progress, value, length: length, easing: easing, finished: (d, finished) => tcs.SetResult(finished)); + + return tcs.Task; + } + } +}
\ No newline at end of file |