Skip to content

Instantly share code, notes, and snippets.

@IshamMohamed
Created March 19, 2017 17:23
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 IshamMohamed/f40954f6fd99a0c0dccb34a42cd38c35 to your computer and use it in GitHub Desktop.
Save IshamMohamed/f40954f6fd99a0c0dccb34a42cd38c35 to your computer and use it in GitHub Desktop.
ListviewWithSearch
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
xmlns:i18n="clr-namespace:One;assembly=One"
xmlns:local="clr-namespace:One;assembly=One"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
prism:ViewModelLocator.AutowireViewModel="True"
x:Class="One.Views.KontaktePage"
Title="{i18n:Translate Text=kontakte}">
<ContentPage.Resources>
<ResourceDictionary>
<local:OneImageConverter x:Key="OneImageConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<Entry Placeholder="{i18n:Translate Text=kontakte_suchen}"
Margin="10"
HorizontalOptions="FillAndExpand"
Text="{Binding Suchtext}"
TextChanged="Handle_TextChanged"
Style="{StaticResource entryStyle}">
</Entry>
<ListView CachingStrategy="RecycleElement"
Margin="10"
x:Name="listViewUsers"
ItemsSource="{Binding Users}"
IsRefreshing="{Binding IsRefreshing}"
IsPullToRefreshEnabled="true"
RefreshCommand="{Binding RefreshDataCommand}"
HasUnevenRows="true"
ItemSelected="Handle_ItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid ColumnSpacing="2" Padding="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<controls:CircleImage
Grid.Row="0"
Grid.Column="0"
HorizontalOptions="Center"
VerticalOptions="Center"
Source="{Binding image, Converter={StaticResource OneImageConverter}, ConverterParameter=placeholder_image.png}">
</controls:CircleImage>
<Label
Grid.Row="0"
Grid.Column="1"
Text="{Binding name}"
TextColor="{StaticResource listFontColor}"
Style="{StaticResource labelStyle}">
</Label>
<Label
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource labelSmallStyle}"
Text="{Binding status}"
TextColor="{Binding statusColor}">
</Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment