Skip to content

Instantly share code, notes, and snippets.

@Pujolsluis
Created December 14, 2019 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pujolsluis/8d30c920c422c00db312114461f1a5c7 to your computer and use it in GitHub Desktop.
Save Pujolsluis/8d30c920c422c00db312114461f1a5c7 to your computer and use it in GitHub Desktop.
Completed Upgrade of the SliderView Sample MainPage
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SliderViewSample"
xmlns:controls="clr-namespace:SliderViewSample.Controls"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Page.UseSafeArea="true"
x:Class="SliderViewSample.MainPage">
<ContentPage.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CarouselView x:Name="MainCarousel"
Grid.Row="0" Grid.RowSpan="2"
ItemsSource="{Binding Data}"
HeightRequest="120">
<CarouselView.ItemTemplate>
<DataTemplate>
<Grid BackgroundColor="{Binding BackgroundColor}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout Padding="8" Grid.Row="0"
VerticalOptions="CenterAndExpand">
<Image Source="{Binding Icon}"
HeightRequest="88" WidthRequest="88"
HorizontalOptions="Center"
Margin="0,0,0,32"/>
<Label HorizontalTextAlignment="Center" Text="{Binding Title}"
HorizontalOptions="Center"
TextColor="White" FontSize="Medium" FontAttributes="Bold"/>
<Label HorizontalTextAlignment="Center" Text="{Binding Description}"
HorizontalOptions="Center"
TextColor="White" FontSize="Small"
Margin="48,0"/>
</StackLayout>
</Grid>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<IndicatorView x:Name="CarouselStepBar"
Grid.Row="0"
HorizontalOptions="FillAndExpand" VerticalOptions="Center"
SelectedIndicatorColor="White" IndicatorColor="Gray"
IndicatorSize="24"
Margin="42,16,42,0"
IndicatorView.ItemsSourceBy="MainCarousel"/>
</Grid>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment