Fixed an issue where some children does not fit in the arranged box.

This commit is contained in:
Burak Kaan Köse
2025-01-02 22:24:04 +01:00
parent 8a9265eb79
commit 48ba4cdf42

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using CommunityToolkit.WinUI;
using Itenso.TimePeriod;
using Windows.Foundation;
using Windows.UI.Xaml;
@@ -160,11 +161,14 @@ namespace Wino.Calendar.Controls
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);
// Make sure measured size will fit in the arranged box.
var measureSize = arrangementRect.ToSize();
control.Measure(measureSize);
control.Arrange(arrangementRect);
//Debug.WriteLine($"{child.Title}, Measured: {measureSize}, Arranged: {arrangementRect}");
}
return finalSize;