Return to Snippet

Revision: 68915
at March 17, 2015 03:58 by jyates99


Updated Code
<DataTemplate x:Key="itemTemplate">
	<ViewCell>
		<ViewCell.View>
			<StackLayout Spacing="0" Padding="10,5,10,5" Orientation="Horizontal" HorizontalOptions="FillAndExpand">
				<CircleImage Source="{Binding ImageSource}" BorderColor="{x:Static App.BrandColor}" BorderThickness="2" HeightRequest="50" 
							 WidthRequest="50" Aspect="AspectFill" HorizontalOptions="Center" VerticalOptions="LayoutOptions.Center" />
				<StackLayout Spacing="0" Padding="10,0,0,0" HorizontalOptions="FillAndExpand">
					<Label Text="{Binding Name}" FontFamily="HelveticaNeue-Medium" FontSize="18" TextColor="Black" />
					<StackLayout Orientation="Horizontal">
						<Label Text="{Binding Distance, StringFormat='{0} Miles Away'" FontAttributes="Bold" FontSize="12" TextColor="#666" />
						<Image Source="online.png" HeightRequest="8" WidthRequest="8" IsVisible="{Binding ShouldShowAsOnline}" />
						<Label Text="Online" TextColor="{x:Static App.BrandColor}" FontSize="12" IsVisible="{Binding ShouldShowAsOnline}" />
						<Image Source="offline.png" HeightRequest="8" WidthRequest="8" IsVisible="{Binding ShouldShowAsOffline}" />
						<Label Text="5 hours ago" TextColor="#ddd" FontSize="12" IsVisible="{Binding ShouldShowAsOffline}" />
					</StackLayout>
					<StackLayout Spacing="3" Orientation="Horizontal">
						<Image Source="star.png" HeightRequest="12" WidthRequest= "12" />
						<Label Text="{Binding Stars}" FontSize="12" TextColor="Gray" />
					</StackLayout>
				</StackLayout>
			</StackLayout>
		</ViewCell.View>
	</ViewCell>
</DataTemplate>

<ListView ItemsSource="{Binding Data}" ItemTemaplate="{StaticResource itemTemplate}" HasUnevenRows="True" SeparatorColor="#ddd" />

Revision: 68914
at March 17, 2015 03:50 by jyates99


Initial Code
<DataTemplate x:Key="itemTemplate">
	<ViewCell>
		<ViewCell.View>
			<StackLayout Spacing="0" Padding="10,5,10,5" Orientation="Horizontal" HorizontalOptions="FillAndExpand">
				<CircleImage Source="{Binding ImageSource}" BorderColor="{x:Static App.BrandColor}" BorderThickness="2" HeightRequest="50" 
							 WidthRequest="50" Aspect="AspectFill" HorizontalOptions="Center" VerticalOptions="LayoutOptions.Center">
				</CircleImage>
				<StackLayout Spacing="0" Padding="10,0,0,0" HorizontalOptions="FillAndExpand">
					<Label Text="{Binding Name}" FontFamily = "HelveticaNeue-Medium" FontSize ="18" TextColor="Black" />
					<StackLayout Orientation="Horizontal">
						<Label Text="{Binding Distance, StringFormat='{0} Miles Away'" FontAttributes ="Bold" FontSize="12" TextColor="#666" />
						<Image Source = "online.png" HeightRequest="8" WidthRequest= "8" IsVisible="{Binding ShouldShowAsOnline}" />
						<Label Text = "Online" TextColor="{x:Static App.BrandColor}" FontSize="12" IsVisible="{Binding ShouldShowAsOnline}" />
						<Image Source = "offline.png" HeightRequest="8" WidthRequest= "8" IsVisible="{Binding ShouldShowAsOffline}" />
						<Label Text = "5 hours ago" TextColor="#ddd" FontSize="12" IsVisible="{Binding ShouldShowAsOffline}" />
					</StackLayout>
					<StackLayout Spacing="3" Orientation="Horizontal">
						<Image Source = "star.png" HeightRequest="12" WidthRequest= "12" />
						<Label Text="{Binding Stars}" FontSize="12" TextColor="Gray" />
					</StackLayout>
				</StackLayout>
			</StackLayout>
		</ViewCell.View>
	</ViewCell>
</DataTemplate>

<ListView ItemsSource="{Binding Data}" ItemTemaplate="{StaticResource itemTemplate}" HasUnevenRows="True" SeparatorColor="#ddd" />

Initial URL


Initial Description
Xamarin Forms ViewCell Xaml snippet

Initial Title
Xamarin Forms ViewCell Xaml snippet

Initial Tags
forms

Initial Language
XML