Hello,
The ReturnType property only provides a difference in button styles and does not affect program behavior.
Enumerates return button styles. Typically the operating system on-screen keyboard will visually style the return key based on this value.
After testing, this issue only appears on the Android platform.
You could refer to the following code to turn off picker's autofocus function.
<Entry x:Name="myentry" ReturnType="Send"/>
<Picker x:Name="testPicker"></Picker>
protected override void OnHandlerChanged()
{
base.OnHandlerChanged();
#if ANDROID
var edit = testPicker.Handler.PlatformView as EditText;
if (edit != null)
{
edit.Focusable = false;
edit.FocusableInTouchMode = false;
}
#endif
}
Update:
Since you can't get the control using DataTemplate
, you could disable autofocus for all Pickers for this page using the following code.
void ModifyPicker()
{
Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
{
#if ANDROID
var edit = handler.PlatformView as EditText;
if (edit != null)
{
edit.Focusable = false;
edit.FocusableInTouchMode = false;
}
#endif
});
}
public MainPage()
{
InitializeComponent();
ModifyPicker();
}
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.