Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2013-10-25 14:31:02 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-10-25 14:31:02 +0400
commit51b89a80410bd72c6dafce59d5ffc0bcfe4fb96f (patch)
tree92ed7f52669e81faca33f7d904b79c968f8d3e31 /Xwt.WPF
parent4b0970039983644acdecc85ff30699bc627a4bab (diff)
[WPF] Widget allocation optimization
Box: Only measure the child widget when it is first added to the box.
Diffstat (limited to 'Xwt.WPF')
-rw-r--r--Xwt.WPF/Xwt.WPFBackend/BoxBackend.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/Xwt.WPF/Xwt.WPFBackend/BoxBackend.cs b/Xwt.WPF/Xwt.WPFBackend/BoxBackend.cs
index 688a01d0..a31a3e1a 100644
--- a/Xwt.WPF/Xwt.WPFBackend/BoxBackend.cs
+++ b/Xwt.WPF/Xwt.WPFBackend/BoxBackend.cs
@@ -120,11 +120,15 @@ namespace Xwt.WPFBackend
// because WPF widgets my cache some measurement information based on the
// constraints provided in the last Measure call (which when calculating the
// preferred size is normally set to infinite.
- element.InvalidateMeasure ();
- element.Measure (new SW.Size (rects[i].Width, rects[i].Height));
-
- element.Arrange (rects[i].ToWpfRect ());
- element.UpdateLayout ();
+ var r = rects[i].WithPositiveSize ();
+ if (force) {
+ // Don't recalculate the size unless a relayout is being forced
+ element.InvalidateMeasure ();
+ element.Measure (new SW.Size (r.Width, r.Height));
+ }
+
+ element.Arrange (r.ToWpfRect ());
+ // element.UpdateLayout ();
}
}
}