Skip to content

ContentPresenter implicit Content binding only applies on Loaded, so the first frame renders empty (WinUI applies it during measure) #25920

Closed

Description

@MartinZikmund

Current behavior 🐛

A ContentPresenter inside a ContentControl template that has no explicit Content/ContentTemplate bindings (e.g. a bare <ContentPresenter/>) only hooks up its implicit bindings to the templated parent in OnApplyTemplate, which Uno runs on Loaded. The first layout pass therefore measures it as empty. For example, a ListViewItem (bare ListViewItemPresenter) renders its first frame with empty 40px items and realizes more containers than WinUI.

Expected behavior 🎯

WinUI sets these bindings in CContentPresenter::ApplyTemplate, which runs from measure, so the first layout already presents the content.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Create a ContentControl with Template = <ControlTemplate TargetType="ContentControl"><ContentPresenter/></ControlTemplate> and Content = new Border { Width = 40, Height = 50 }.
  2. Call Measure(new Size(200, 200)) before it is loaded.
  3. DesiredSize is 0,0 on Uno; 40,50 on WinUI.

Workaround 🛠️

None.

Affected platforms 📱💻🖥️

Skia (all)

Uno.Sdk version (and other relevant versions) 📦

master

IDE version 🧑‍💻

N/A

Anything else we need to know? 💬

Found while working on #25389.

Activity

  1. added
    kind/bug
    on Nov 2, 2026
  2. Sergio0694 commented on Nov 4, 2026

    @Sergio0694

    Is this by any chance the bug that causes SettingsCard-s (from the Toolkit) to visible resize when displayed, because the icon on the left first renders as empty, then it loads, and takes the right size and shifts the text right? I can see this for a split second when loading pages 🤔

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

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions