Skip to content

Hidden ListView doesn't appear as expected #27630

@vpshonyak

Description

@vpshonyak

Description

If ListView initially invisible, then attempt to make it visible fails

Steps to Reproduce

  1. Create new .NET MAUI app;
  2. Add XAML to your MainPage.xaml:
<StackLayout>
    <Button Text="Show/Hide ListView" Clicked="Button_Clicked" />
    <ListView x:Name="ListView1" IsVisible="False">
        <ListView.ItemsSource>
            <x:Array Type="{x:Type x:String}">
                <x:String>Item 1</x:String>
                <x:String>Item 2</x:String>
                <x:String>Item 3</x:String>
            </x:Array>
        </ListView.ItemsSource>
    </ListView>
</StackLayout>
  1. Add code:
        private void Button_Clicked(object sender, EventArgs e)
        {
            ListView1.IsVisible = !ListView1.IsVisible;
        }
  1. Run your app;
  2. Tap the 'Show/Hide ListView' button several times;

Expected behavior: ListView should shows up after the first tap;

Actual behavior: on Android ListView shows up only after 3rd tap; on iPhone ListView never shows up.

Link to public reproduction project repository

https://github.com/vpshonyak/BugListView.git

Version with bug

9.0.30 SR3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

iOS, Android

Affected platform versions

No response

Did you find any workaround?

On Android works if 'ListView1.IsVisible = !ListView1.IsVisible;' replaced with:

ListView1.IsVisible = !ListView1.IsVisible;
ListView1.IsVisible = !ListView1.IsVisible;
ListView1.IsVisible = !ListView1.IsVisible;

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions