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

Sliders inside a ListView react oddly to touch

$
0
0

Hi,

I have a ListView and a custom DataTemplate -- the DataTemplate is essentially a ViewCell with a Slider inside. Something like this:

class SliderCell : ViewCell {
        public static readonly BindableProperty ValueProperty = BindableProperty.Create<SliderCell, double>(x=>x.Value, 0);
        public double Value {
            get { (double)GetValue (ValueProperty); }
            set  { 
                SetValue (ValueProperty, value);
                OnPropertyChanged ("Value");
            }
        }
        public SliderCell ()
        {
            var slider = new Slider { Maximum = 10, Minimum = 0, BindingContext = this };
            slider.SetBinding(Slider.ValueProperty, new Binding("Value", BindingMode.TwoWay));
            this.View = slider;
        }
    }

If (and only if) the BindingMode in at the end is TwoWay OR OneWayToSource, then it's not possible to set the value of the slider, it does not really change value if I move my finger left-right. However (now it starts to become really strange) it changes its value completely fine if I move my finger up-down.. If BindingMode is OneWay then it all works fine.

Any ideas would be appreciated.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>