Skip to content

Instantly share code, notes, and snippets.

@felipebaltazar
Created January 13, 2021 03:41
Show Gist options
  • Save felipebaltazar/8310e8a11d67ab713b6f8d51e5e62cf4 to your computer and use it in GitHub Desktop.
Save felipebaltazar/8310e8a11d67ab713b6f8d51e5e62cf4 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CollectionViewDemo.MainPage">
<ContentPage.ToolbarItems>
<ToolbarItem IconImageSource="Pedido.png"
Priority="0" Order="Primary"
Command="{Binding AdicionarPedidoCommand}"/>
</ContentPage.ToolbarItems>
<ContentPage.Content>
<!--<RelativeLayout>-->
<FlexLayout Direction="Column" >
<!-- Body -->
<Label Text="{Binding InfoPrincipal}"
HorizontalTextAlignment="Center"
FontFamily="FBold"
IsVisible="{Binding InfoIsVisible}"
Background="#F0F0F0"/>
<FlexLayout FlexLayout.Grow="1">
<Grid BackgroundColor="#F0F0F0" RowDefinitions="82*,18*">
<!-- LISTA DE PEDIDOS -->
<CollectionView Grid.Row="0"
BackgroundColor="Red"
SelectionMode="Single" x:Name="lvUsers"
EmptyView="Não há pedidos de doações no momento"
ItemsSource="{Binding ListaPedidosItemsSource}">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Spacing="8" >
<Frame x:Name="grItem" CornerRadius="10" Margin="5" Padding="5" HorizontalOptions="FillAndExpand" HasShadow="True" BorderColor="DarkGray">
<StackLayout Margin="5" HorizontalOptions="FillAndExpand" Spacing="10" BackgroundColor="White">
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical">
<!-- NOME -->
<Label Text="{Binding Nome}"
FontSize="19"
FontAttributes="Bold"
TextColor="#A40112"
VerticalTextAlignment="Center" />
<StackLayout Orientation="Horizontal">
<!-- DOAÇÕES RECEBIDAS -->
<Label Text="Qtd. doadores"
Margin="0,-9,0,0"
FontAttributes="Bold"
TextColor="{Binding ColorObjetivoConcluido }"
FontSize="12" />
<Label Text="{Binding QtdInformado}"
Margin="-4,-9,0,0"
FontAttributes="Bold"
TextColor="{Binding ColorObjetivoConcluido }"
FontSize="12" />
<Label Text="/"
Margin="-5,-9,0,0"
FontAttributes="Bold"
TextColor="{Binding ColorObjetivoConcluido }"
FontSize="12" />
<Label Text="{Binding QtdDoador}"
Margin="-5,-9,0,0"
FontAttributes="Bold"
TextColor="{Binding ColorObjetivoConcluido }"
FontSize="12" />
</StackLayout>
</StackLayout>
</StackLayout>
<Label Text="{Binding Pedido}"
FontSize="17"
TextColor="Black"/>
<Label Text="Comentários" FontAttributes="Bold"
Margin="0,0,0,-10"
TextColor="Black"
FontSize="13" />
<Label Text="{Binding Com1}"
Margin="0,-10,0,0"
TextColor="Black"
FontSize="12" />
<BoxView HeightRequest="1" BackgroundColor="Silver"/>
<Label Text="{Binding InfoPedido}" TextColor="#04537D"/>
<!-- BOTÕES DE MENUS -->
<StackLayout Orientation="Horizontal" >
<Grid RowSpacing="0" ColumnSpacing="0" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="100*"/>
</Grid.ColumnDefinitions>
<!--CONTATO-->
<FlexLayout Direction="Column" AlignItems="Center" Grid.Row="0" Grid.Column="0" >
<Label TextColor="#04537D" FontFamily="FontAwesomeSolid" FontSize="28" >
<Label.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1"
Command="{Binding ContatoCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}" />
</Label.GestureRecognizers>
</Label>
<!-- LABEL CONTATO -->
<Label >
<Label.FormattedText>
<FormattedString>
<Span
Text="Contato" FontSize="10" TextColor="#04537D">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ContatoCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}"
NumberOfTapsRequired="1"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</FlexLayout>
<!--INFORMAR DOAÇÃO-->
<FlexLayout Direction="Column" AlignItems="Center" Grid.Row="0" Grid.Column="1" >
<Label TextColor="#04537D" FontFamily="FontAwesomeSolid" FontSize="28" >
<Label.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1"
Command="{Binding InformarCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}" />
</Label.GestureRecognizers>
</Label>
<!-- LABEL INFORMAR -->
<Label >
<Label.FormattedText>
<FormattedString>
<Span
Text="Informar" FontSize="10" TextColor="#04537D">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding InformarCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}"
NumberOfTapsRequired="1"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</FlexLayout>
<!--AGRADEÇER DOAÇÃO-->
<FlexLayout Direction="Column" AlignItems="Center" Grid.Row="0" Grid.Column="2" >
<Label TextColor="#04537D" FontFamily="FontAwesomeSolid" FontSize="28" >
<Label.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1"
Command="{Binding AgradecerCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}" />
</Label.GestureRecognizers>
</Label>
<!-- LABEL AGRADECER -->
<Label >
<Label.FormattedText>
<FormattedString>
<Span
Text="Agradecer" FontSize="10" TextColor="#04537D">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding AgradecerCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}"
NumberOfTapsRequired="1"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</FlexLayout>
<!--COMENTAR-->
<FlexLayout Direction="Column" AlignItems="Center" Grid.Row="0" Grid.Column="3" >
<Label TextColor="#04537D" FontFamily="FontAwesomeSolid" FontSize="28" >
<Label.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1"
Command="{Binding ComentarCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}" />
</Label.GestureRecognizers>
</Label>
<!-- LABEL COMENTAR -->
<Label >
<Label.FormattedText>
<FormattedString>
<Span
Text="Comentar" FontSize="10" TextColor="#04537D">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ComentarCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}"
NumberOfTapsRequired="1"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</FlexLayout>
<!--EDITAR -->
<FlexLayout Direction="Column" AlignItems="Center" Grid.Row="0" Grid.Column="4">
<Label TextColor="#04537D" FontFamily="FontAwesomeSolid" FontSize="28" >
<Label.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1"
Command="{Binding EditarPedidoCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}" />
</Label.GestureRecognizers>
</Label>
<!-- LABEL EDITAR -->
<Label >
<Label.FormattedText>
<FormattedString>
<Span
Text="Editar" FontSize="10" TextColor="#04537D">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding EditarPedidoCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}"
NumberOfTapsRequired="1"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</FlexLayout>
<!-- DENUNCIAR -->
<FlexLayout Direction="Column" AlignItems="Center" Grid.Row="0" Grid.Column="5">
<Label TextColor="#04537D" FontFamily="FontAwesomeSolid" FontSize="28" >
<Label.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1"
Command="{Binding DenunciarPedidoCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}" />
</Label.GestureRecognizers>
</Label>
<!-- LABEL DENUNCIAR -->
<Label >
<Label.FormattedText>
<FormattedString>
<Span
Text="Denunciar" FontSize="10" TextColor="#04537D">
<Span.GestureRecognizers>
<TapGestureRecognizer Command="{Binding DenunciarPedidoCommand}"
BindingContext="{Binding Source={x:Reference lvUsers}, Path=BindingContext}"
CommandParameter="{Binding Source={x:Reference grItem}, Path=BindingContext}"
NumberOfTapsRequired="1"/>
</Span.GestureRecognizers>
</Span>
</FormattedString>
</Label.FormattedText>
</Label>
</FlexLayout>
</Grid>
</StackLayout>
</StackLayout>
</Frame>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<!-- LISTA DE USUÁRIOS -->
<CollectionView Grid.Row="1"
BackgroundColor="Blue"
VerticalOptions="CenterAndExpand"
SelectionMode="Single"
ItemsUpdatingScrollMode="KeepItemsInView"
EmptyView="Não há doadores disponíveis no momento"
SelectedItem="{Binding ListaDoadoresSelectItem, Mode=TwoWay}"
ItemsSource="{Binding ListaDoadoresItemsSource}">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Spacing="8" HorizontalOptions="EndAndExpand">
<Frame
CornerRadius="10"
Margin="5"
Padding="5"
HorizontalOptions="FillAndExpand"
HasShadow="True"
BorderColor="Silver"
BackgroundColor="White" >
<StackLayout Orientation="Horizontal" Spacing="3" >
<Label Text="{Binding TpSangue}" VerticalTextAlignment="Center" FontAttributes="Bold" FontSize="20" TextColor="#A40112"/>
<Frame CornerRadius="10" Margin="5" Padding="1" HorizontalOptions="FillAndExpand" HasShadow="True" BackgroundColor="{Binding CorVermVerde}" WidthRequest="1"></Frame >
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Spacing="2" >
<StackLayout Orientation="Horizontal">
<Label Text="{Binding NivelDoador}" TextColor="#A40112" Margin="0,4,0,0" FontFamily="FontAwesomeSolid" FontSize="13" />
<Label Text="{Binding Nome}"
FontSize="17"
FontAttributes="Bold"
TextColor="#A40112" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Desde}"
FontSize="12"
Margin="0,-7,0,0"
TextColor="Black" />
<Label Text="{Binding UltimoAcesso}"
FontSize="12"
Margin="0,-7,0,0"
TextColor="Black" />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding DiasProximaDoacao}"
FontSize="15"
FontAttributes="Bold"
Margin="0,-5,0,0"
TextColor="{Binding ColorDoacao}" />
</StackLayout>
<Label Text="{Binding DoadorDE}"
FontSize="15"
Margin="0,-5,0,0"
TextColor="Black" />
<Label Text="{Binding Localidade}"
FontSize="15"
Margin="0,-5,0,0"
TextColor="Black" />
</StackLayout>
</StackLayout>
</Frame>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</FlexLayout>
<!-- Footer -->
</FlexLayout>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment