maui-linux/Xamarin.Forms.Platform.iOS/CollectionView/HorizontalTemplatedCell.cs

34 строки
868 B
C#

using System;
using CoreGraphics;
using Foundation;
using UIKit;
namespace Xamarin.Forms.Platform.iOS
{
internal sealed class HorizontalTemplatedCell : TemplatedCell
{
public static NSString ReuseId = new NSString("Xamarin.Forms.Platform.iOS.HorizontalTemplatedCell");
[Export("initWithFrame:")]
public HorizontalTemplatedCell(CGRect frame) : base(frame)
{
}
public override CGSize Measure()
{
var measure = VisualElementRenderer.Element.Measure(double.PositiveInfinity,
ConstrainedDimension, MeasureFlags.IncludeMargins);
var width = VisualElementRenderer.Element.Width > 0
? VisualElementRenderer.Element.Width : measure.Request.Width;
return new CGSize(width, ConstrainedDimension);
}
public override void ConstrainTo(CGSize constraint)
{
ConstrainedDimension = constraint.Height;
Layout(constraint);
}
}
}