public static void UpdateItemsLayout(this TCollectionView platformView, StructuredItemsView view) { if (view.ItemsLayout != null) { var itemSizingStrategy = view.ItemSizingStrategy.ToPlatform(); if (view.ItemsLayout is GridItemsLayout grid) { var orientation = grid.Orientation == ItemsLayoutOrientation.Horizontal; var verticalItemSpacing = DPExtensions.ConvertToScaledPixel(grid.VerticalItemSpacing); var horizontalItemSpacing = DPExtensions.ConvertToScaledPixel(grid.HorizontalItemSpacing); platformView.LayoutManager = new GridLayoutManager(orientation, grid.Span, itemSizingStrategy, verticalItemSpacing, horizontalItemSpacing); } else if (view.ItemsLayout is LinearItemsLayout linear) { var orientation = linear.Orientation == ItemsLayoutOrientation.Horizontal; var itemSpacing = DPExtensions.ConvertToScaledPixel(linear.ItemSpacing); platformView.LayoutManager = new LinearLayoutManager(orientation, itemSizingStrategy, itemSpacing); } else { platformView.LayoutManager = new LinearLayoutManager(false); } platformView.SnapPointsType = (view.ItemsLayout as ItemsLayout).SnapPointsType.ToPlatform(); platformView.SelectionMode = (view as SelectableItemsView).SelectionMode.ToPlatform(); } }
public void VerticalListMeasurement() { var itemsView = new StructuredItemsView(); var sizeRequest = itemsView.Measure(double.PositiveInfinity, double.PositiveInfinity); Assert.That(sizeRequest.Request.Height, Is.EqualTo(Device.Info.ScaledScreenSize.Height)); Assert.That(sizeRequest.Request.Width, Is.EqualTo(Device.Info.ScaledScreenSize.Width)); }
public void HorizontalListMeasurement() { var itemsView = new StructuredItemsView(); itemsView.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); var sizeRequest = itemsView.Measure(double.PositiveInfinity, double.PositiveInfinity); Assert.That(sizeRequest.Request.Height, Is.EqualTo(Device.Info.ScaledScreenSize.Height)); Assert.That(sizeRequest.Request.Width, Is.EqualTo(Device.Info.ScaledScreenSize.Width)); }
public void BindingContextPropagatesLayouts() { var bindingContext = new object(); var itemsView = new StructuredItemsView(); itemsView.BindingContext = bindingContext; var linearItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal); itemsView.ItemsLayout = linearItemsLayout; // BindingContext is set when ItemsLayout is set Assert.AreEqual(itemsView.BindingContext, linearItemsLayout.BindingContext); // BindingContext is updated when BindingContext on ItemsView is changed bindingContext = new object(); itemsView.BindingContext = bindingContext; Assert.AreEqual(itemsView.BindingContext, linearItemsLayout.BindingContext); }
public StructuredItemsViewController(StructuredItemsView structuredItemsView, ItemsViewLayout layout) : base(structuredItemsView, layout) { }
public static void MapHeaderTemplate(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { handler.PlatformView.UpdateAdaptor(itemsView); }
public static void MapItemSizingStrategy(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { handler.PlatformView.UpdateItemsLayout(itemsView); }
public static void MapItemSizingStrategy(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { handler.UpdateLayout(); }
public static void MapItemsLayout(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { }
protected override void SetUpNewElement(TItemsView newElement) { _itemsView = newElement; base.SetUpNewElement(newElement); }
public static StructuredItemsView HeaderTemplate(this StructuredItemsView items, DataTemplate template) { items.HeaderTemplate = template; return(items); }
public static StructuredItemsView Header(this StructuredItemsView items, object header, DataTemplate template) { items.Header = header; items.HeaderTemplate = template; return(items); }
public static StructuredItemsView Header(this StructuredItemsView items, object header) { items.Header = header; return(items); }
public static StructuredItemsView Footer(this StructuredItemsView items, object footer, DataTemplate template) { items.Footer = footer; items.FooterTemplate = template; return(items); }
public EmptyItemAdaptor(ItemsView itemsView, IEnumerable items, DataTemplate template) : base(itemsView, items, template) { _structuredItemsView = itemsView as StructuredItemsView; }
public static StructuredItemsView ItemsLayout(this StructuredItemsView items, IItemsLayout layout) { items.ItemsLayout = layout; return(items); }
public static StructuredItemsView ItemSizingStrategy(this StructuredItemsView items, ItemSizingStrategy strategy) { items.ItemSizingStrategy = strategy; return(items); }
public static void MapFooterTemplate(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { }
public static StructuredItemsView Footer(this StructuredItemsView items, object footer) { items.Footer = footer; return(items); }
public static void MapItemSizingStrategy(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { }
public static void MapFooterTemplate(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView) { (handler.Controller as StructuredItemsViewController <TItemsView>)?.UpdateFooterView(); }