Skip to content

Native panel#10063

Closed
asklar wants to merge 1 commit intomicrosoft:mainfrom
asklar:nativeLayout-2
Closed

Native panel#10063
asklar wants to merge 1 commit intomicrosoft:mainfrom
asklar:nativeLayout-2

Conversation

@asklar
Copy link
Copy Markdown
Member

@asklar asklar commented Jun 6, 2022

In order to support layout/size changes coming from XAML (e.g. Expander gets expanded) and have it reflow through Yoga, we need a notification to be fired when the element's measure changes.
That notification doesn't exist but we can wrap the native XAML control in a custom Panel, where we can use the MeasureOverride override to mark the corresponding yoga node as dirty and trigger a Yoga re-layout.

However, the problem is that this panel would have its width/height set by the Yoga layout pass. As a result, XAML will not call MeasureOverride (if W/H are set, you don't need to be notified, you'll be that size!).

To work around that, we need a second outer panel, which gets the W/H set, and hosts the panel with the notification code:

<NativeHostPanel Width="200" Height="48">
  <NativeMeasuringPanel>
    <Expander />
  </NativeMeasuringPanel>
</NativeHostPanel>

the Width/Height in the outermost panel will be set by Yoga based on its desired size.

Microsoft Reviewers: Open in CodeFlow

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant