* Ground work for NET9 UWP switch. * Add launch settings for Wino.Mail * Added new test WAP project * fix platforms in slnx solution * ManagePackageVersionsCentrally set default * Fixing assets and couple issues with the new packaging project. * Add back markdown * Fix nuget warnings * FIx error in WAP about build tools * Add build.props with default language preview * Some AOT compilation progress. * More AOT stuff. * Remove deprecated protocol auth activation handler. * Fix remaining protocol handler for google auth. * Even more AOT * More more AOT fixes * Fix a few more AOT warnings * Fix signature editor AOT * Fix composer and renderer AOT JSON * Outlook Sync AOT * Fixing bundle generation and package signing. --------- Co-authored-by: Burak Kaan Köse <bkaankose@outlook.com>
71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using System;
|
|
|
|
namespace Wino.Core.UWP.Controls
|
|
{
|
|
using Windows.Foundation;
|
|
using Windows.UI.Xaml;
|
|
using Windows.UI.Xaml.Controls;
|
|
|
|
namespace CustomControls
|
|
{
|
|
public partial class CustomWrapPanel : Panel
|
|
{
|
|
protected override Size MeasureOverride(Size availableSize)
|
|
{
|
|
double currentRowWidth = 0;
|
|
double currentRowHeight = 0;
|
|
double totalHeight = 0;
|
|
|
|
foreach (UIElement child in Children)
|
|
{
|
|
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
|
|
|
var childDesiredSize = child.DesiredSize;
|
|
|
|
if (currentRowWidth + childDesiredSize.Width > availableSize.Width)
|
|
{
|
|
// Wrap to the next row
|
|
totalHeight += currentRowHeight;
|
|
currentRowWidth = 0;
|
|
currentRowHeight = 0;
|
|
}
|
|
|
|
currentRowWidth += childDesiredSize.Width;
|
|
currentRowHeight = Math.Max(currentRowHeight, childDesiredSize.Height);
|
|
}
|
|
|
|
totalHeight += currentRowHeight;
|
|
|
|
return new Size(availableSize.Width, totalHeight);
|
|
}
|
|
|
|
protected override Size ArrangeOverride(Size finalSize)
|
|
{
|
|
double currentRowWidth = 0;
|
|
double currentRowHeight = 0;
|
|
double currentY = 0;
|
|
|
|
foreach (UIElement child in Children)
|
|
{
|
|
var childDesiredSize = child.DesiredSize;
|
|
|
|
if (currentRowWidth + childDesiredSize.Width > finalSize.Width)
|
|
{
|
|
currentY += currentRowHeight;
|
|
currentRowWidth = 0;
|
|
currentRowHeight = 0;
|
|
}
|
|
|
|
child.Arrange(new Rect(new Point(currentRowWidth, currentY), childDesiredSize));
|
|
|
|
currentRowWidth += childDesiredSize.Width;
|
|
currentRowHeight = Math.Max(currentRowHeight, childDesiredSize.Height);
|
|
}
|
|
|
|
return finalSize;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|