Skip to content

CollectionView.EmptyView does not remeasure its height when the parent layout changes dynamically, causing incorrect sizing. #33324

@softlion

Description

@softlion

Description

CollectionView.EmptyView does not remeasure its height when the parent layout changes dynamically, causing incorrect sizing.

Steps to Reproduce

Steps to Reproduce

  1. Create a page with two CollectionView controls in a vertical layout:

    • First CollectionView: Initially hidden with IsVisible="{Binding HasItems}"
    • Second CollectionView: Below the first, displays EmptyView with custom content (e.g., a Grid with background and Label)
  2. Initial state: First CollectionView is hidden (no items), second CollectionView shows EmptyView with full available height

  3. Load data: First CollectionView receives items and becomes visible, pushing the second CollectionView down

  4. Bug: The second CollectionView adjusts its position and overall height correctly, but its EmptyView content retains the original height from step 2, not remeasuring to fit the new available space

Expected Behavior

When the parent layout changes and available space decreases, the EmptyView should remeasure and resize its content to fit the new constraints.

Actual Behavior

The EmptyView retains its original measured height even after the parent layout changes, resulting in content that doesn't fit the new available space.

Basic Information

  • Version: .NET 10.0 / Microsoft.Maui.Controls 10.0.20
  • Platform: Android (issue may affect other platforms)
  • Affected control: CollectionView.EmptyView

Code Sample

<Grid RowDefinitions="Auto,*" RowSpacing="20">
    <VerticalStackLayout>
        <!-- First CollectionView - becomes visible when data loads -->
        <VerticalStackLayout IsVisible="{Binding HasGames}">
            <CollectionView ItemsSource="{Binding MyGames}" MaximumHeightRequest="300">
                <!-- ItemTemplate -->
            </CollectionView>
        </VerticalStackLayout>
    </VerticalStackLayout>

    <!-- Second CollectionView - EmptyView doesn't remeasure -->
    <CollectionView Grid.Row="1" ItemsSource="{Binding Players}">
        <CollectionView.EmptyView>
            <Grid>
                <local:CustomBackground />
                <Label Text="No players" HorizontalOptions="Center" VerticalOptions="Center" />
            </Grid>
        </CollectionView.EmptyView>
    </CollectionView>
</Grid>

Link to public reproduction project repository

No response

Version with bug

10.0.20

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 16

Did you find any workaround?

nope

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewCollectionView, CarouselView, IndicatorViewpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions