Skip to content

Commit

Permalink
fix(AutoLayout): Making sure the AutoLayout is correctly loaded befor…
Browse files Browse the repository at this point in the history
…e updating the layout (unoplatform#458) (unoplatform#462)
  • Loading branch information
agneszitte committed Jan 27, 2023
1 parent fdb7b68 commit bce2532
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Uno.Toolkit.UI/Controls/AutoLayout/AutoLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public AutoLayout()
DefaultStyleKey = typeof(AutoLayout);
Children = new AutoLayoutChildren();

Loaded += OnLoaded;

this.RegisterDisposablePropertyChangedCallback(HorizontalAlignmentProperty, (snd, e) => UpdateAutoLayout());
this.RegisterDisposablePropertyChangedCallback(VerticalAlignmentProperty, (snd, e) => UpdateAutoLayout());
this.RegisterDisposablePropertyChangedCallback(PaddingProperty, (snd, e) => UpdateAutoLayout());
Expand All @@ -41,6 +43,11 @@ protected override void OnApplyTemplate()
UpdateAutoLayout();
}

private static void OnLoaded(object sender, RoutedEventArgs e)
{
(sender as AutoLayout)?.UpdateAutoLayout();
}

public static readonly DependencyProperty IsReverseZIndexProperty = DependencyProperty.Register(
"IsReverseZIndex", typeof(bool), typeof(AutoLayout), new PropertyMetadata(default(bool), propertyChangedCallback: UpdateCallback));

Expand Down

0 comments on commit bce2532

Please sign in to comment.