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

Picker shows 5 modals during .Focus()

$
0
0

I have a picker wrapped in a ViewCell as follows:

`public class GenderPickerCell : ViewCell
{
private readonly Label _label = new Label();
private readonly Picker _genderPicker = new Picker();
private readonly StackLayout _stackLayout = new StackLayout();

    public GenderPickerCell()
    {
        _label.Text = "Click Here";

        _genderPicker.Items.Add("Male");
        _genderPicker.Items.Add("Female");

        Tapped += (sender, args) => _genderPicker.Focus();

        _stackLayout.Children.Add(_label);
        _stackLayout.Children.Add(_genderPicker);

        View = _stackLayout;
    }
}`

When you activate the Tapped event of the ViewCell, calling the control's Picker.Focus() method will then activate 5 instances of the window. To add confusion, the ViewCell.Tapped, Picker.Focused, and Picker.Unfocused events are only firing once as expected.

This is only happening in Android and iOS is working as expected.

  • Android (Compile 17, Min 15)
  • XF 1.2.3

Viewing all articles
Browse latest Browse all 58056

Trending Articles