locked
Change form in runtime depending on value chosen on Picker RRS feed

  • Question

  • User393905 posted

    I've set some fields of my form invisible by default. I have a picker with 2 options. If option 1 is chosen, those fields should remain invisible, but if I choose option 2, I'd like to put those fields visible. I can get value chosen of the picker but I don't know how to make field visible/invisible in runtime. Any idea ?

    Sunday, April 12, 2020 2:25 PM

Answers

  • User393905 posted

    Found solution with the following code

    ` public void mouvementEntry_SelectedIndexChanged(object sender, EventArgs e) {

            var picker = sender as Picker;
            if(picker.Items[picker.SelectedIndex].Equals("Dépense"))
            {
                categoryEntry.IsVisible = true;
                labelCategory.IsVisible = true;
            }
            else
            {
                categoryEntry.IsVisible = false;
                labelCategory.IsVisible = false;
            }
        }`
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Sunday, April 12, 2020 2:51 PM