According to @SushiHangover's answer, we can make a ViewRenderer to achieve your effect.
First, create your own ProgressView , make sure it is inherited from ContentView . also add BindableProperty to represent the value:
public partial class ProgressView : ContentView { public double Progress { set { SetValue(ProgressProperty, value); } get { return (double)GetValue(ProgressProperty); } } public readonly static BindableProperty ProgressProperty = BindableProperty.Create("Progress", typeof(double), typeof(ProgressView), 0.0); ... }
Then we can make Custom renderer as:
protected override void OnElementChanged(ElementChangedEventArgs<View> e) { base.OnElementChanged(e);
Since this is in the renderer, we need to update our label frame:
public override void Draw(CGRect rect) { base.Draw(rect); ... label.Frame = Bounds; }
Finally, we can use it in Forms, for example:
<local:ProgressView x:Name="MyProgress" HeightRequest="50"/>
Land Lu - MSFT
source share