Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

TapGestureRecognizer on Slider

$
0
0

Hello,

I have a cross platform project with Android and iOS. I'm using the Slider element and wish to make it recognize a tap as a change to a value in the slider.

XAML

<Slider HorizontalOptions="FillAndExpand"
             Value="{Binding SliderValue, Source={StaticResource someViewModel}}">  <-- this works
    <Slider.GestureRecognizers>
    <TapGestureRecognizer
        Command = "{Binding SeekTo, Source={StaticResource someViewModel}}"/> <--- this doesn't
    </Slider.GestureRecognizers>
</Slider>

However this seems to never register the tap? Is it not supported for the Slider element? My command 'SeekTo' in my viewModel.cs is shown as this:

someViewModel.cs

public class someViewModel : BaseViewModel {
      public ICommand SeekTo { get; set; }
      public someViewModel () {
            SeekTo = new Command ( () => {
                System.Diagnostics.Debug.WriteLine ("TEST");
            });
      }
 }

It does not output "TEST" when I tap on it. What can I do?


Viewing all articles
Browse latest Browse all 75885

Trending Articles