зеркало из https://github.com/DeGsoft/maui-linux.git
27 строки
1.2 KiB
C#
27 строки
1.2 KiB
C#
using System.Collections.Generic;
|
|
using Windows.UI.Xaml;
|
|
using WSize = Windows.Foundation.Size;
|
|
|
|
namespace Xamarin.Forms.Platform.UWP
|
|
{
|
|
public delegate SizeRequest? GetDesiredSizeDelegate(NativeViewWrapperRenderer renderer, double widthConstraint, double heightConstraint);
|
|
|
|
public delegate WSize? ArrangeOverrideDelegate(NativeViewWrapperRenderer renderer, WSize finalSize);
|
|
|
|
public delegate WSize? MeasureOverrideDelegate(NativeViewWrapperRenderer renderer, WSize availableSize);
|
|
|
|
public static class LayoutExtensions
|
|
{
|
|
public static void Add(this IList<View> children, FrameworkElement view, GetDesiredSizeDelegate getDesiredSizeDelegate = null, ArrangeOverrideDelegate arrangeOverrideDelegate = null,
|
|
MeasureOverrideDelegate measureOverrideDelegate = null)
|
|
{
|
|
children.Add(view.ToView(getDesiredSizeDelegate, arrangeOverrideDelegate, measureOverrideDelegate));
|
|
}
|
|
|
|
public static View ToView(this FrameworkElement view, GetDesiredSizeDelegate getDesiredSizeDelegate = null, ArrangeOverrideDelegate arrangeOverrideDelegate = null,
|
|
MeasureOverrideDelegate measureOverrideDelegate = null)
|
|
{
|
|
return new NativeViewWrapper(view, getDesiredSizeDelegate, arrangeOverrideDelegate, measureOverrideDelegate);
|
|
}
|
|
}
|
|
} |