lundi 11 janvier 2016

How to display unique items in an SQLite database to a Picker in C#

i have an assignment and am stock at populating items from a column in the SQLite database to a picker here is my code

from the database model

public IEnumerable<SingleSignerTable> GetItemList()
        {
            return _database.Query<SingleSignerTable>("SELECT * FROM [SingleSignerTable]");
        }

from the front end

lCategory = new Label
            {
                Text = "Category",
                FontAttributes = Font.SystemFontOfSize(5, FontAttributes.Bold).FontAttributes,
            };
            lField = new Picker { Title = "Category", VerticalOptions = LayoutOptions.Start };

            lField.SelectedIndexChanged += lSport_SelectedIndexChanged;

            FieldOption = new List<string> { "Others", GetItemList()};
            foreach (string option in FieldOption)
            {
                lField.Items.Add(option);
            };

private string GetItemList()
        {
            foreach (string option in FieldOption)
            {
                lField.Items.Add(option);
            };
        }

but the code doesn't seem to work

Aucun commentaire:

Enregistrer un commentaire