Open dr1rrb opened 2 years ago
I just tested this on skia. Also broken. The problem is that Loaded
is fired before Arrange
, so LayoutSlot will still be the default value. A simple workaround is to queue the callback.
private void DumpData(object sender, object o)
{
DispatcherQueue.TryEnqueue(new Microsoft.UI.Dispatching.DispatcherQueueHandler(new Action(() =>
{
var elt = (FrameworkElement)sender;
global::System.Diagnostics.Debug.WriteLine($"{elt.Name} layout slot:{F(Microsoft.UI.Xaml.Controls.Primitives.LayoutInformation.GetLayoutSlot(elt))} origin: {elt.TransformToVisual(this).TransformPoint(new Point())}");
string F(Rect rect) => $"{rect.Width:F2}x{rect.Height:F2}@{rect.X:F2},{rect.Y:F2}";
})));
}
This will probably be fixed by @Youssef1313 lifecycle work.
This may have been fixed on Skia.
Current behavior
The
LayoutInformation.GetLayoutSlot
does not give same result as UWPExpected behavior
🙃
How to reproduce it (as minimally and precisely as possible)
In a blank app
UWP (expected)
Android
Workaround
None
Works on UWP/WinUI
No response
Environment
No response
NuGet package version(s)
3.10.0-dev.632
Affected platforms
Android
IDE
No response
IDE version
No response
Relevant plugins
none
Anything else we need to know?
Not validated yet on iOS
Ok on Skia and WASM