Reputation: 2389
In Android Slider, the ProgressChangedEventArgs has a FromUser property.
In Xamarin forms Slider, there seems to be no way one can distinguish between changing the Slider's Value in code vs moving the slider knob. Is this because this functionality is not in ios's UISlider?
Short of embedding native controls, is there a way to achieve this functionality?
Upvotes: 2
Views: 509
Reputation: 2624
The way I achieved this was sending a message when the slider is touched using MessagingCenter. I created custom renderers for iOS and Android. In Android I send Messages in StartTrackingTouch and StopTrackingTouch for the SeekBar. On iOS I believe I just used the AllTouchEvents event which was fine for my purposes.
Another method is if the value is changing from the model, send an event to the ViewModel rather than change the value directly (which is bad design anyhow if the value is changing in the model and the model can access the ViewModel.) In my case I needed to know when the slider was touched because the value was constantly changing from the network and I needed to invalidate the network responses for a period so the user did not experience the slider jumping around.
Upvotes: 1