Slider Thumb Tap on iOS

Download Sample Download the sample

This iOS platform-specific enables the Slider.Value property to be set by tapping on a position on the Slider bar, rather than by having to drag the Slider thumb. It's consumed in XAML by setting the Slider.UpdateOnTap bindable property to true:

<ContentPage ...
             xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core">
    <StackLayout ...>
        <Slider ... ios:Slider.UpdateOnTap="true" />
        ...
    </StackLayout>
</ContentPage>

Alternatively, it can be consumed from C# using the fluent API:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
...

var slider = new Xamarin.Forms.Slider();
slider.On<iOS>().SetUpdateOnTap(true);

The Slider.On<iOS> method specifies that this platform-specific will only run on iOS. The Slider.SetUpdateOnTap method, in the Xamarin.Forms.PlatformConfiguration.iOSSpecific namespace, is used to control whether a tap on the Slider bar will set the Slider.Value property. In addition, the Slider.GetUpdateOnTap method can be used to return whether a tap on the Slider bar will set the Slider.Value property.

The result is that a tap on the Slider bar can move the Slider thumb and set the Slider.Value property: