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

Xamarin.Forms render picker like spinner in Android

$
0
0

Hello guys ! I am making an app using Xamarin.Forms and I am trying to make an picker to work as spinner like in Android but no idea how to make it. I tried to make a render control also. Here is my code

public class CustomPicker : Picker { }

In Android render :

[assembly: ExportRenderer(typeof(CustomPicker), typeof(SabKuchhFresh.Renderers.PickeRenderer))]
namespace App.Renderers
{
public class PickeRenderer : ViewRenderer<Xamarin.Forms.View, Spinner>
{
Spinner mySpinner;
// Override the OnModelChanged method so we can tweak this renderer post-initial setup

    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)
    {
        base.OnElementChanged(e);

        mySpinner = new Spinner(this.Context);
        this.SetNativeControl(mySpinner);
    }
}

}

Please help. Thanks in advance ! :)


Viewing all articles
Browse latest Browse all 91519

Trending Articles