I have a custom switch like
public class CustomSwitch : Switch
{
public CustomSwitch ()
{
}
}
and when i write a renderer for this switch to change button drawable using android selector
public class CustomSwitchRenderer : SwitchRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Switch> e)
{
base.OnElementChanged (e);
if (e.OldElement == null)
{
Switch element = (Switch) this.Element;
var native = (global::Android.Widget.Switch) Control;
native.SetButtonDrawable (Resource.Drawable.toggle_button_selector);
}
}
}
Two switches are displayed one is default and another based on selector...
Please suggest what i am doing wrong.
Any help is highly appreciated.