From 7925fa8c659ce961ff691d934827726a18a71e44 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 26 Dec 2015 20:57:30 +0000 Subject: [PATCH] Cache Margin in MeasureCore. --- src/Perspex.Layout/Layoutable.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Perspex.Layout/Layoutable.cs b/src/Perspex.Layout/Layoutable.cs index 329719187c..9930c24614 100644 --- a/src/Perspex.Layout/Layoutable.cs +++ b/src/Perspex.Layout/Layoutable.cs @@ -446,11 +446,13 @@ namespace Perspex.Layout { if (IsVisible) { + var margin = Margin; + ApplyTemplate(); var constrained = LayoutHelper .ApplyLayoutConstraints(this, availableSize) - .Deflate(Margin); + .Deflate(margin); var measured = MeasureOverride(constrained); var width = measured.Width; @@ -472,7 +474,7 @@ namespace Perspex.Layout height = Math.Min(height, MaxHeight); height = Math.Max(height, MinHeight); - return NonNegative(new Size(width, height).Inflate(Margin)); + return NonNegative(new Size(width, height).Inflate(margin)); } else {