Skip to content

Commit 4823790

Browse files
maxkatz6danwalmsley
authored andcommitted
Merge pull request AvaloniaUI#8409 from AvaloniaUI/fixes/devtools-promotes-values-to-localvalue
Don't promote layout property values to local values in DevTools.
1 parent c4d7a98 commit 4823790

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlLayoutViewModel.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,28 @@ public ControlLayoutViewModel(IVisual control)
3030

3131
if (control is AvaloniaObject ao)
3232
{
33-
MarginThickness = ao.GetValue(Layoutable.MarginProperty);
34-
35-
if (HasPadding)
33+
try
3634
{
37-
PaddingThickness = ao.GetValue(Decorator.PaddingProperty);
38-
}
35+
_updatingFromControl = true;
36+
MarginThickness = ao.GetValue(Layoutable.MarginProperty);
37+
38+
if (HasPadding)
39+
{
40+
PaddingThickness = ao.GetValue(Decorator.PaddingProperty);
41+
}
3942

40-
if (HasBorder)
43+
if (HasBorder)
44+
{
45+
BorderThickness = ao.GetValue(Border.BorderThicknessProperty);
46+
}
47+
48+
HorizontalAlignment = ao.GetValue(Layoutable.HorizontalAlignmentProperty);
49+
VerticalAlignment = ao.GetValue(Layoutable.VerticalAlignmentProperty);
50+
}
51+
finally
4152
{
42-
BorderThickness = ao.GetValue(Border.BorderThicknessProperty);
53+
_updatingFromControl = false;
4354
}
44-
45-
HorizontalAlignment = ao.GetValue(Layoutable.HorizontalAlignmentProperty);
46-
VerticalAlignment = ao.GetValue(Layoutable.VerticalAlignmentProperty);
4755
}
4856

4957
UpdateSize();

0 commit comments

Comments
 (0)