protected override Button CreatePlatformView() => new Button { AllowFocusOnInteraction = false, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, Content = new StackPanel { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Orientation = Orientation.Horizontal, Margin = WinUIHelpers.CreateThickness(0), Children = { new Image { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Stretch = Stretch.Uniform, Margin = WinUIHelpers.CreateThickness(0), Visibility = UI.Xaml.Visibility.Collapsed, }, new TextBlock { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = WinUIHelpers.CreateThickness(0), Visibility = UI.Xaml.Visibility.Collapsed, } } } };
ListViewBase CreateCarouselListLayout(ItemsLayoutOrientation layoutOrientation) { UI.Xaml.Controls.ListView listView; if (layoutOrientation == ItemsLayoutOrientation.Horizontal) { listView = new FormsListView() { Style = (UI.Xaml.Style)WApp.Current.Resources["HorizontalCarouselListStyle"], ItemsPanel = (ItemsPanelTemplate)WApp.Current.Resources["HorizontalListItemsPanel"] }; ScrollViewer.SetHorizontalScrollBarVisibility(listView, WScrollBarVisibility.Auto); ScrollViewer.SetVerticalScrollBarVisibility(listView, WScrollBarVisibility.Disabled); } else { listView = new FormsListView() { Style = (UI.Xaml.Style)WApp.Current.Resources["VerticalCarouselListStyle"] }; ScrollViewer.SetHorizontalScrollBarVisibility(listView, WScrollBarVisibility.Disabled); ScrollViewer.SetVerticalScrollBarVisibility(listView, WScrollBarVisibility.Auto); } listView.Padding = WinUIHelpers.CreateThickness(ItemsView.PeekAreaInsets.Left, ItemsView.PeekAreaInsets.Top, ItemsView.PeekAreaInsets.Right, ItemsView.PeekAreaInsets.Bottom); return(listView); }
void UpdateCornerRadius() { float cornerRadius = Element.CornerRadius; if (cornerRadius == -1f) { cornerRadius = 5f; // default corner radius } Control.CornerRadius = WinUIHelpers.CreateCornerRadius(cornerRadius); }
void UpdateBorder() { if (Element.BorderColor.IsNotDefault()) { Control.BorderBrush = Element.BorderColor.ToPlatform(); Control.BorderThickness = WinUIHelpers.CreateThickness(1); } else { Control.BorderBrush = new Color(0, 0, 0, 0).ToPlatform(); } }
void UpdatePeekAreaInsets() { ListViewBase.Padding = WinUIHelpers.CreateThickness(ItemsView.PeekAreaInsets.Left, ItemsView.PeekAreaInsets.Top, ItemsView.PeekAreaInsets.Right, ItemsView.PeekAreaInsets.Bottom); UpdateItemsSource(); }