Skip to content

AppKit: CollectionView rows added after the page appears are realised but never drawn #685

Open

Description

@oughnic

Summary

On AppKit, a CollectionView whose source starts empty and gains items after the page is shown reserves the right height for its rows but draws none of them. The items are realised: DevFlow lists each row's labels with sensible window bounds. But the area is blank on screen. The behaviour is the same with or without a workaround that re-adds a layout's late children.

How it shows

The page is a Shell page: ScrollView → VerticalStackLayout holding an empty-state Label, the CollectionView (SelectionMode.None, an ObservableCollection<T> source, a DataTemplate of a Grid with two Labels) and a Button under it. The page clears the collection and adds three to six items once its data loads, after the page has appeared.

  • On screen: blank space where the rows should be, and the button pushed down by the rows' total height.
  • maui devflow ui query --type Label lists the row labels (for example "Birth", "4 JUN 1738 · …", "Death", "Burial") at x=36 y=382 w=436 h=21 and below, inside the reserved area.

The same page draws its rows on WinUI, WPF and Android. We have not reduced it to a standalone repro yet.

Where it may come from (not traced)

The AppKit CollectionViewHandler decides which items to show from its own scroll view's visible rect (visibleRect, with viewportOverride "during initial layout"). Here the CollectionView doesn't scroll: it's sized to its content inside an outer ScrollView. If the items are positioned against a visible rect taken while the list was still empty (zero high), or the platform views are added but never displayed after the list grows, the rows would exist with frames yet not draw.

Expected

As on the other backends: rows added after the page appears draw in full.

Environment

  • AppKit: macOS 26.6.2 on Apple silicon; Xcode 26.6; .NET SDK 10.0.401 with the macOS workload 26.5.10318; Microsoft.Maui.Controls 10.0.70; Microsoft.Maui.Platforms.MacOS 0.1.0-preview.13.26512.5.

Code link: dotnet/maui-labs main at 543f864.

Activity

  1. jfversluis commented on Oct 15, 2026

    @jfversluis
    Member

    @oughnic Could you try the AppKit packages built by PR #698 in your original app and confirm whether the asynchronously added CollectionView rows now draw?

    Download and extract the packages-macos-appkit-macos-latest artifact (GitHub sign-in required). Add the extracted folder as a local NuGet source, then update your Microsoft.Maui.Platforms.MacOS package reference to the version in that folder. If you reference other AppKit backend packages, use the matching versions from the same artifact. Please check that restore actually selects these packages rather than your previous version.

    We reproduced and fixed a related case where the rows and labels are realized, but the CollectionView remains zero-height inside the outer ScrollView. Native before/after screenshots and glyph checks confirm that case now draws. However, your report describes reserved height with blank rows, which we have not confirmed is the same failure, so your original page is the important verification before we consider #685 resolved.

    Please let us know whether the rows appear after the initial async load and after a clear/reload, and whether the button below them remains correctly positioned. If it is still blank, please include the CollectionView, clip/document and label bounds (or a small repro, if possible), together with the package version you tested.

  2. oughnic commented on Oct 21, 2026

    @oughnic
    Author

    Tried the AppKit packages from the #698 build: Microsoft.Maui.Platforms.MacOS and .Essentials at 0.1.0-ci.815.1 (our project.assets.json resolves 0.1.0-ci.815.1). Fixed in our app.

    Same page, same data, same steps on both builds (a person's Events page, whose rows are added once the list has loaded; one real click for each step, and DevFlow for the screenshots):

    • 0.1.0-preview.13.26512.5: reproduces exactly as reported. The area for the rows is blank, the "Add event" button is pushed down by the rows' height, and the header band above the page also moves down.
    • 0.1.0-ci.815.1: every row draws (date and place under each event name), the "Add event" button sits straight under the last row, and the header is in its normal place. We also checked the Person page, which draws all of its sections, so nothing else regressed there.

    We did not check the clear-and-reload case separately.

    Environment: macOS 26.6.2 on Apple silicon, Xcode 26.6, .NET SDK 10.0.402, Microsoft.Maui.Controls 10.0.110.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions