Fixed an issue where some children does not fit in the arranged box.
This commit is contained in:
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using CommunityToolkit.WinUI;
|
||||||
using Itenso.TimePeriod;
|
using Itenso.TimePeriod;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
@@ -160,11 +161,14 @@ namespace Wino.Calendar.Controls
|
|||||||
|
|
||||||
if (childWidth < 0) childWidth = 1;
|
if (childWidth < 0) childWidth = 1;
|
||||||
|
|
||||||
control.Measure(new Size(childWidth, childHeight));
|
|
||||||
|
|
||||||
var arrangementRect = new Rect(childLeft + EventItemMargin.Left, childTop + EventItemMargin.Top, Math.Max(childWidth - extraRightMargin, 1), childHeight);
|
var arrangementRect = new Rect(childLeft + EventItemMargin.Left, childTop + EventItemMargin.Top, Math.Max(childWidth - extraRightMargin, 1), childHeight);
|
||||||
|
|
||||||
|
// Make sure measured size will fit in the arranged box.
|
||||||
|
var measureSize = arrangementRect.ToSize();
|
||||||
|
control.Measure(measureSize);
|
||||||
control.Arrange(arrangementRect);
|
control.Arrange(arrangementRect);
|
||||||
|
|
||||||
|
//Debug.WriteLine($"{child.Title}, Measured: {measureSize}, Arranged: {arrangementRect}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalSize;
|
return finalSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user