The topic of this article is to place a floating text on the slider icon as it moves, without having to define a custom renderer. You can download the project here.
First, we define our page:
Then, we write the code that when the slider icon moves, the text above it move and change with it.
I’m explain the TranslateTo method we used here. This method is one of the extension methods provided by the ViewExtension class. Other than TranslateTo, this class also includes RelScaleTo, RotateTo, RelRotateTo, RotateXTo, RotateYTo and FadeTo methods. Each of these methods is asynchronous and returns the Task <bool> object.By default, each animation takes 250 milliseconds. However, a duration for each animation can be specified when creating the animation. Animation methods should generally be used with the await operator, which allows you to easily determine when an animation is completed. However, if there’s a requirement to let an animation complete in the background, then the await operator may not be used.
For change the color of slider we should add below lines to AppDelegate.cs file:
UISlider.Appearance.TintColor = UIColor.FromRGBA(255, 160, 0, 255); UISlider.Appearance.ThumbTintColor = UIColor.FromRGBA(255, 160, 0, 255);
You can download github project here.
Article suggestion: https://blog.xamarin.com/creating-animations-with-xamarin-forms/[:]