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 (#458)
  • Loading branch information
Agnès Zitte committed Jan 27, 2023
1 parent fdb7b68 commit ddb411b
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 ddb411b

Please sign in to comment.