I want to numeric counterup/down animation my xamarin forms application. I found the code example here
But i haven't applied. How can i apply this behavior class Xamarin Forms label control.
I tried this code but not work.
<Label x:Name="lblScore" FontSize="24" TextColor="Black" Text="{Binding Number}" HorizontalOptions="Center" VerticalOptions="CenterAndExpand">
<Label.Behaviors>
<controls:NumericTextAnimationBehavior Value="{Binding Number}"/>
</Label.Behaviors>
</Label>
CodeBehind:
public partial class ProfilePage : ContentPage
{
public string Number { get; set; }
public ProfilePage()
{
InitializeComponent();
this.BindingContext = this;
lblScore.Behaviors.Add(new NumericTextAnimationBehavior());
}
private void btnSetRandom_Clicked(object sender, EventArgs e)
{
Random randomizer = new Random();
Number = randomizer.Next(1, 9999).ToString();
lblScore.Text = Number;
}
}
It's not worked on my project. I want to apply counter animation for label.
Thank you for your supports.