예제 #1
0
 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();
     }
 }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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)
 {
 }
예제 #10
0
        protected override void SetUpNewElement(TItemsView newElement)
        {
            _itemsView = newElement;

            base.SetUpNewElement(newElement);
        }
예제 #11
0
 public static StructuredItemsView HeaderTemplate(this StructuredItemsView items, DataTemplate template)
 {
     items.HeaderTemplate = template;
     return(items);
 }
예제 #12
0
 public static StructuredItemsView Header(this StructuredItemsView items, object header, DataTemplate template)
 {
     items.Header         = header;
     items.HeaderTemplate = template;
     return(items);
 }
예제 #13
0
 public static StructuredItemsView Header(this StructuredItemsView items, object header)
 {
     items.Header = header;
     return(items);
 }
예제 #14
0
 public static StructuredItemsView Footer(this StructuredItemsView items, object footer, DataTemplate template)
 {
     items.Footer         = footer;
     items.FooterTemplate = template;
     return(items);
 }
예제 #15
0
 public EmptyItemAdaptor(ItemsView itemsView, IEnumerable items, DataTemplate template) : base(itemsView, items, template)
 {
     _structuredItemsView = itemsView as StructuredItemsView;
 }
예제 #16
0
 public static StructuredItemsView ItemsLayout(this StructuredItemsView items, IItemsLayout layout)
 {
     items.ItemsLayout = layout;
     return(items);
 }
예제 #17
0
 public static StructuredItemsView ItemSizingStrategy(this StructuredItemsView items, ItemSizingStrategy strategy)
 {
     items.ItemSizingStrategy = strategy;
     return(items);
 }
 public static void MapFooterTemplate(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView)
 {
 }
예제 #19
0
 public static StructuredItemsView Footer(this StructuredItemsView items, object footer)
 {
     items.Footer = footer;
     return(items);
 }
 public static void MapItemSizingStrategy(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView)
 {
 }
예제 #21
0
 public static void MapFooterTemplate(StructuredItemsViewHandler <TItemsView> handler, StructuredItemsView itemsView)
 {
     (handler.Controller as StructuredItemsViewController <TItemsView>)?.UpdateFooterView();
 }