Listview UI Design 3
Listview UI Design
In this tutorial we will learn how to design listview with image.
Listview is the most commonly used scrolling widget. It display its children one after another in scroll direction.
We have four listview designs:
- Design 1: https://xamarinuidesigns.blogspot.com/2021/12/listview-ui-design-1.html
- Design 2: https://xamarinuidesigns.blogspot.com/2021/12/listview-ui-design-2.html
- Design 3: https://xamarinuidesigns.blogspot.com/2021/12/listview-ui-design-3.html
- Design 4: https://xamarinuidesigns.blogspot.com/2021/12/listview-ui-design-4.html
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:ListviewUIDesigns.Views.Template"
x:Class="ListviewUIDesigns.Views.ListViewDesign3"
BackgroundColor="LightGray"
Title="ListView Design 3">
<ContentPage.Content>
<StackLayout Padding="10">
<ListView x:Name ="listView" HasUnevenRows="True" SeparatorVisibility="None" ItemSelected="listView_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell >
<views:Design3Template></views:Design3Template>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Design 3 Template
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ListviewUIDesigns.Views.Template.Design3Template">
<ContentView.Content>
<StackLayout Padding="5" >
<Frame x:Name="frame" HasShadow="True" CornerRadius="20" Padding="0">
<Grid HorizontalOptions="FillAndExpand" BackgroundColor="White" VerticalOptions="FillAndExpand" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="{Binding Img}" HeightRequest="100" WidthRequest="100" Aspect="Fill"></Image>
<StackLayout Grid.Column="1" Spacing="0" Padding="0,10" >
<Label Text="{Binding Name}" FontAttributes="Bold" HorizontalOptions="FillAndExpand" TextColor="Black"></Label>
<Label Text="{Binding Description}" HorizontalOptions="FillAndExpand" TextColor="Black"></Label>
</StackLayout>
<StackLayout Grid.Column="2" Spacing="0" WidthRequest="60" Padding="0" VerticalOptions="CenterAndExpand">
<Label Text="{Binding Day}" FontAttributes="Bold" FontSize="20" TextColor="Black" HorizontalOptions="Center"></Label>
<Label Text="{Binding Month}" TextColor="Black" HorizontalOptions="Center" ></Label>
</StackLayout>
</Grid>
</Frame>
</StackLayout>
</ContentView.Content>
</ContentView>
Comments
Post a Comment