Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Strange Picker behaviour when used in NavigationPage #2349

Closed
mterhorst opened this issue Sep 1, 2021 · 3 comments
Closed

[Bug] Strange Picker behaviour when used in NavigationPage #2349

mterhorst opened this issue Sep 1, 2021 · 3 comments
Labels
area-controls-picker Picker area-navigation NavigationPage s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Milestone

Comments

@mterhorst
Copy link

mterhorst commented Sep 1, 2021

Description

I encountered two problems with the Picker control, when it is used in a NavigationPage.

Issue #⁠1

A Picker item is selectable, even when IsEnabled is set to False.

1.mp4

Issue #⁠2

The Picker item selector opens automatically, after navigated to a new page.

2.mp4

Steps to Reproduce

MainPage.xaml:

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="TestApp.MainPage"
             BackgroundColor="{DynamicResource SecondaryColor}" Title="This is a navigation page">

    <ScrollView >
        <Grid RowSpacing="25" RowDefinitions="Auto,Auto,Auto">
            <Picker x:Name="picker" Title="Select a monkey">
                <Picker.Items>
                    <x:String>Baboon</x:String>
                    <x:String>Capuchin Monkey</x:String>
                    <x:String>Blue Monkey</x:String>
                    <x:String>Squirrel Monkey</x:String>
                    <x:String>Golden Lion Tamarin</x:String>
                    <x:String>Howler Monkey</x:String>
                    <x:String>Japanese Macaque</x:String>
                </Picker.Items>
            </Picker>
            <Button Text="Disable picker" Clicked="OnBtnDisablePicker" Grid.Row="1"/>
            <Button Text="Navigate new page" Clicked="OnBtnPush" Grid.Row="2"/>
        </Grid>
    </ScrollView>
</ContentPage>

MainPage.xaml.cs:

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();
    }

    private void OnBtnDisablePicker(object sender, EventArgs e)
    {
        picker.IsEnabled = !picker.IsEnabled;
    }

    private async void OnBtnPush(object sender, EventArgs e)
    {
        await Navigation.PushAsync(new MainPage());
    }
}

App.xaml.cs:

public partial class App : Application
{
    public App()
    {
        InitializeComponent();
        MainPage = new NavigationPage(new MainPage());
    }
}

Expected Behavior

I expected to not be able to change the selected Picker item, when it's enabled state is set to False.
The Picker item selector should not display on it's own, without actually clicking on it.

Basic Information

  • Version with issue: preview 7 - preview 12
  • Last known good version: unknown
  • IDE: Visual Studio 2022 17.1 Preview 3.0
  • Platform Target Frameworks:
    • Android
@jsuarezruiz jsuarezruiz added the t/bug Something isn't working label Sep 14, 2021
@jsuarezruiz jsuarezruiz added this to New in Triage via automation Oct 22, 2021
@jsuarezruiz jsuarezruiz added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-navigation NavigationPage labels Oct 22, 2021
@mterhorst
Copy link
Author

Any progress on this?

@v-xiaofchen
Copy link

Verified repro with Android 11 and the above project.
Picture1
attached the repro sample
MauiApp4.zip

@v-xiaofchen v-xiaofchen added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Feb 23, 2022
@Redth Redth added this to the 6.0.300 milestone Mar 22, 2022
@samhouts
Copy link
Member

Outstanding bug report. I love the videos and the sample code. Thank you!

Good news. I can no longer reproduce this on main.

Triage automation moved this from New to Done Apr 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 23, 2022
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-picker Picker area-navigation NavigationPage s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

6 participants