Skip to content

Instantly share code, notes, and snippets.

@farukaf
Created December 5, 2020 14:06
Show Gist options
  • Save farukaf/9a75e4954f2ebc456b8b72aee3e293c0 to your computer and use it in GitHub Desktop.
Save farukaf/9a75e4954f2ebc456b8b72aee3e293c0 to your computer and use it in GitHub Desktop.
Xamarin Problemas de Grid e Sobreposição no iOS
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Shell.NavBarIsVisible="True"
BackgroundColor="{StaticResource StrongBGColor}"
xmlns:vm="clr-namespace:DriverPerformance.ViewModels"
Title="{Binding Title}"
Visual="Material"
x:Class="DriverPerformance.Views.Comprovantes">
<ContentPage.BindingContext>
<vm:ComprovantesViewModel />
</ContentPage.BindingContext>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Filtros" Clicked="Filtros_Clicked"/>
</ContentPage.ToolbarItems>
<ContentPage.Content>
<Grid VerticalOptions="Fill" Padding="15,10">
<ListView ItemsSource="{Binding Comprovantes}"
VerticalOptions="Fill"
x:Name="ListViewComprovantes"
SelectionMode="Single"
IsPullToRefreshEnabled="True"
Refreshing="ListViewComprovantes_Refreshing"
ItemSelected="ListViewComprovantes_ItemSelected"
RowHeight="65">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid BackgroundColor="{StaticResource LightBGColor}" Margin="0,5" Padding="8,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Text="{Binding DataRegistro, StringFormat='{0:dd/MM/yyyy}'}" VerticalOptions="Start" FontAttributes="Bold" />
<Label Grid.Row="1" Text="{Binding TipoComprovante}" VerticalOptions="End" />
</Grid>
<Label Grid.Column="2"
Text="&#xf138;"
FontFamily="FontAwesomeBold"
FontSize="24"
Margin="5,0,2,0"
VerticalOptions="Center"
HorizontalOptions="End" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!-- O Botão aparece normalmente sobrepondo o listview no canto inferior esquerdo da pagina -->
<Button Text="&#xf067;"
FontSize="24"
x:Name="btnNovoComprovante"
Clicked="btnNovoComprovante_Clicked"
FontFamily="FontAwesomeBold"
VerticalOptions="EndAndExpand"
HorizontalOptions="EndAndExpand" />
<Frame Padding="10"
CornerRadius="35"
Margin="10"
Opacity="0.8"
BackgroundColor="{StaticResource StrongBGColor}"
IsVisible="{Binding IsBusy}"
VerticalOptions="StartAndExpand"
HorizontalOptions="CenterAndExpand">
<ActivityIndicator x:Name="actInd"
HeightRequest="50"
WidthRequest="50"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
BackgroundColor="{StaticResource LightBGColor}"
IsRunning="{Binding IsBusy}"
Color="{StaticResource PrimaryColor}"/>
</Frame>
</Grid>
</ContentPage.Content>
</ContentPage>
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Shell.NavBarIsVisible="True"
BackgroundColor="{StaticResource StrongBGColor}"
xmlns:vm="clr-namespace:DriverPerformance.ViewModels"
Title="{Binding Title}"
Visual="Material"
x:Class="DriverPerformance.Views.ComprovanteItem">
<ContentPage.BindingContext>
<vm:ComprovanteItemViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>
<Grid VerticalOptions="Fill" Padding="15,10">
<ScrollView VerticalOptions="Fill">
<StackLayout VerticalOptions="StartAndExpand">
<Label Text="Tipo de Comprovante" FontAttributes="Bold"/>
<Picker ItemsSource="{Binding Tipos}" SelectedItem="{Binding TipoComprovante}" IsEnabled="{Binding PodeSalvar}" />
<Image Source="{Binding ComprovanteSource}" />
<Grid HeightRequest="60"></Grid>
</StackLayout>
</ScrollView>
<!-- Os botões ficam por traz do shell na versão de iOs -->
<Grid VerticalOptions="EndAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Text="&#xf0c6;"
FontSize="20"
WidthRequest="80"
HorizontalOptions="Start"
x:Name="btnAnexar"
Clicked="btnAnexar_Clicked"
FontFamily="FontAwesomeBold" />
<Button Grid.Column="1"
Text="&#xf030;"
FontSize="20"
WidthRequest="80"
x:Name="btnFoto"
Clicked="btnFoto_Clicked"
HorizontalOptions="Center"
FontFamily="FontAwesomeBold" />
<Button Grid.Column="2"
x:Name="btnSalvar"
IsVisible="{Binding PodeSalvar}"
Clicked="btnSalvar_Clicked"
HorizontalOptions="End"
Text="Salvar" />
<Button Grid.Column="2"
x:Name="btnExcluir"
IsVisible="{Binding PodeExcluir}"
Clicked="btnExcluir_Clicked"
HorizontalOptions="End"
Text="Excluir" />
</Grid>
<Frame Padding="10"
CornerRadius="35"
Margin="10"
Opacity="0.8"
BackgroundColor="{StaticResource StrongBGColor}"
IsVisible="{Binding IsBusy}"
VerticalOptions="StartAndExpand"
HorizontalOptions="CenterAndExpand">
<ActivityIndicator x:Name="actInd"
HeightRequest="50"
WidthRequest="50"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
BackgroundColor="{StaticResource LightBGColor}"
IsRunning="{Binding IsBusy}"
Color="{StaticResource PrimaryColor}"/>
</Frame>
</Grid>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment