Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

picker focus() not show dialog pop-up in just android 9.0 (Xamarin.forms 3.5) #5433

Closed
1mohmmad4 opened this issue Mar 3, 2019 · 3 comments

Comments

@1mohmmad4
Copy link

Description

picker in xamarin.forms version 3.5 is not working in android 9.0 but in previous version of android or even all system versions of iOS it is working good if you are tap on picker or focus on it by focus() function in code behind of from anywhere it will show you the dialog pop-up.

Expected Behavior

show dialog pop-up when click on picker or focus on it.

Actual Behavior

not showing dialog pop-up when click on picker or focus.

Basic Information

  • Version with issue: 3.5
  • Last known good version: 3.2
  • Platform Target Frameworks:
    • Android: 9.0
@PureWeen
Copy link
Contributor

PureWeen commented Mar 3, 2019

most likely a duplicate of
#5159

@1mohmmad4
Copy link
Author

  • custom control :

using System;
using Xamarin.Forms;

namespace Common.Localization.Controlls
{
public class PickerExt : Picker
{
public Action ShowPicker;
}
}

=================================

  • Xaml File :

              <controlls:PickerExt  x:Name="PickerList"/>
    

=================================

code behind:

        if(Device.RuntimePlatform == Device.Android)
            PickerList.ShowPicker?.Invoke();

=================================

Renderer for android

[assembly: ExportRenderer(typeof(PickerExt), typeof(PickerExtRenderer))]
namespace MainApp.Droid.Renderers
{
public class PickerExtRenderer : Xamarin.Forms.Platform.Android.AppCompat.PickerRenderer
{
protected PickerExt PickerExt { get; private set; }

    public PickerExtRenderer(Context context) : base(context)
    {
        AutoPackage = false;
    }
    protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
    {
        base.OnElementChanged(e);
        if (Control == null)
            return;

        PickerExt = (PickerExt)Element;
        PickerExt.ShowPicker = () => Control.PerformClick();
    }
}

}

@samhouts
Copy link
Contributor

samhouts commented Mar 4, 2019

Duplicate of #5159

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants