Another option for Drop Down List

Hi All,

I am trying to use the drop down control but i think is not available in xamarin.
So what is the another option for drop down in xamarin.shared app.
Please some one guide me.

Answers

  • Vikram_BVikram_B USMember ✭✭

    @ManinderKalra

    Could you please confirm are you trying to implement the drop down control in Xamarin forms or Xamarin android????

    if possible can you post your code .....

  • @vikramboya i am trying to implement drop down control in xamarin forms.

  • Vikram_BVikram_B USMember ✭✭

    @ManinderKalra

    try the below code snippet and add the picker to the parent content page.......

    Picker statepick = new Picker ();
    statepick.WidthRequest = 300;
    statepick.Title = "Select a state";
    statepick.Items.Add ("India");
    statepick.Items.Add ("US");
    statepick.Items.Add ("Arizona");
    statepick.Items.Add ("China");

            statepick.SelectedIndexChanged += (sender, e) => {
                if (statepick.SelectedIndex == -1) {
                    DisplayAlert ("Title", "Item not selected", "ok");
                } else {
                 statename = statepick.Items [statepick.SelectedIndex];
                    Console.WriteLine ("Selected country is:" + statename);
                }
            };
    
  • @vikramboya Thanks! :smile:
    I will try to use this snippet in my project.

Sign In or Register to comment.