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

How to get the control element from code behind without FindByName?

$
0
0

Hi,

Am new to xamarin. I'm trying to build a page that show multiple(1-10 not fixed) picker that filter the next corresponding picker.
Have created a content page with a stacklayout and creating picker with a loop and adding them to stacklayout children.
I'm not able to get the next picker element.
this is where i am now. Hope someone is able to help. Thanks.

public partial class Details : ContentPage
{
public Details()
{
var Options = List<List>();

    var _pickerID = new List<Guid>();
    for(var i = 0; i < Options.count; i++) 
        {
        var picker = new Picker();
        _pickerID.Add(ddl.Id);
        picker.SelectedIndexChanged += DynamicLoadOption;
        foreach (var item in Options[i].list)
                {
                     picker.Items.Add(item);
                }
    }
}
public void DynamicLoadOption (object sender, EventArgs e)
{
    Picker hey = sender as Picker;
            var _index = _pickerID.FindIndex(z => z == hey.Id);
    // how can i get the next picker element in line? so i can update it's content item??
}   

}


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>