I am trying to put in function an IOS custom renderer for Slider control. Due to wrapping class SlideriOS the event are not firing and I need DragCompleted event. Somebody has an idea how to trigger/route the event to the control?
[assembly: ExportRenderer(typeof(CustomGradientSlider), typeof(CustomGradientSliderRenderer))]
namespace HealMate.iOS.Renderers
{
public class CustomGradientSliderRenderer : SliderRenderer
{
public CGColor StartColor { get; set; }
public CGColor CenterColor { get; set; }
public CGColor EndColor { get; set; }
private UIImage GradImage { get; set; }
public string SelectionColor1 { get; set; }
public string SelectionColor2 { get; set; }
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
{
if (Control == null)
{
var customSlider = e.NewElement as CustomGradientSlider;
StartColor = customSlider.StartColor.ToCGColor();
CenterColor = customSlider.CenterColor.ToCGColor();
EndColor = customSlider.EndColor.ToCGColor();
var slider = new SlideriOS
{
Continuous = true,
Height = (nfloat)customSlider.HeightRequest
};
SetNativeControl(slider);
Control.ValueChanged += OnControlValueChanged;
}
base.OnElementChanged(e);
}
...
public class SlideriOS : UISlider
{
public nfloat Height { get; set; }
public override CGRect TrackRectForBounds(CGRect forBounds)
{
var rect = base.TrackRectForBounds(forBounds);
return new CGRect(rect.X, rect.Y, rect.Width, Height);
}
}
}
How can I fire the DragCompleted event for the slider control ? Thanks!