From fd882afa2d3c26224b644022908aad8f34d3a95c Mon Sep 17 00:00:00 2001 From: Lluis Sanchez Date: Mon, 16 Apr 2012 11:23:20 +0200 Subject: [PATCH] Fix scrolling for widgets inside a Paned --- Xwt.WPF/Xwt.WPFBackend/PanedBackend.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Xwt.WPF/Xwt.WPFBackend/PanedBackend.cs b/Xwt.WPF/Xwt.WPFBackend/PanedBackend.cs index 2563b752..bb4ae393 100644 --- a/Xwt.WPF/Xwt.WPFBackend/PanedBackend.cs +++ b/Xwt.WPF/Xwt.WPFBackend/PanedBackend.cs @@ -374,6 +374,20 @@ namespace Xwt.WPFBackend panel1.Size = new GridLength (position, GridUnitType.Star); panel2.Size = new GridLength (availableSize - position, GridUnitType.Star); + + // The measure method has to be called on the children. Widgets like TreeView require + // a Measure call with the real size constraints, otherwise it can't decide if the + // scrollbars have to be shown or not + panel1.Widget.InvalidateMeasure (); + panel2.Widget.InvalidateMeasure (); + if (direction == Orientation.Horizontal) { + panel1.Widget.Measure (new SW.Size (position, size.Height)); + panel2.Widget.Measure (new SW.Size (availableSize - position, size.Height)); + } + else { + panel1.Widget.Measure (new SW.Size (size.Width, position)); + panel2.Widget.Measure (new SW.Size (size.Width, availableSize - position)); + } } else if (panel1.Widget != null) panel1.Size = new GridLength (1, GridUnitType.Star);