ListViewBase CreateCarouselListLayout(ItemsLayoutOrientation layoutOrientation) { Windows.UI.Xaml.Controls.ListView listView; if (layoutOrientation == ItemsLayoutOrientation.Horizontal) { listView = new FormsListView() { Style = (Windows.UI.Xaml.Style)UWPApp.Current.Resources["HorizontalCarouselListStyle"], ItemsPanel = (ItemsPanelTemplate)UWPApp.Current.Resources["HorizontalListItemsPanel"] }; ScrollViewer.SetHorizontalScrollBarVisibility(listView, WScrollBarVisibility.Auto); ScrollViewer.SetVerticalScrollBarVisibility(listView, WScrollBarVisibility.Disabled); } else { listView = new FormsListView() { Style = (Windows.UI.Xaml.Style)UWPApp.Current.Resources["VerticalCarouselListStyle"] }; ScrollViewer.SetHorizontalScrollBarVisibility(listView, WScrollBarVisibility.Disabled); ScrollViewer.SetVerticalScrollBarVisibility(listView, WScrollBarVisibility.Auto); } listView.Padding = new Windows.UI.Xaml.Thickness(CarouselView.PeekAreaInsets.Left, CarouselView.PeekAreaInsets.Top, CarouselView.PeekAreaInsets.Right, CarouselView.PeekAreaInsets.Bottom); return(listView); }
protected override ListViewBase SelectListViewBase() { ListViewBase listView = null; switch (Layout) { case LinearItemsLayout listItemsLayout: listView = CreateCarouselListLayout(listItemsLayout.Orientation); break; } if (listView == null) { listView = new FormsListView(); } FindScrollViewer(listView); return(listView); }
ListViewBase CreateCarouselListLayout(ItemsLayoutOrientation layoutOrientation) { Windows.UI.Xaml.Controls.ListView listView; if (layoutOrientation == ItemsLayoutOrientation.Horizontal) { listView = new FormsListView() { Style = (Windows.UI.Xaml.Style)UWPApp.Current.Resources["HorizontalCarouselListStyle"], ItemsPanel = (ItemsPanelTemplate)UWPApp.Current.Resources["HorizontalListItemsPanel"] }; } else { listView = new FormsListView() { Style = (Windows.UI.Xaml.Style)UWPApp.Current.Resources["VerticalCarouselListStyle"] }; } return(listView); }