Skip to content

Instantly share code, notes, and snippets.

@felipebastosweb
Last active April 10, 2025 22:17
Show Gist options
  • Save felipebastosweb/90868c65352c9a6977b2a14a84f1d1b5 to your computer and use it in GitHub Desktop.
Save felipebastosweb/90868c65352c9a6977b2a14a84f1d1b5 to your computer and use it in GitHub Desktop.
Exemplo de ContentPage em MAUI.Net usando apenas C#
using Microsoft.Maui.Controls;
public class EcommercePage : ContentPage
{
public EcommercePage()
{
// Layout principal da página
Content = new StackLayout
{
Children =
{
CreateHeader(),
CreateBody(),
CreateFooter()
}
};
}
private StackLayout CreateHeader()
{
return new StackLayout
{
BackgroundColor = Colors.LightGray,
Padding = new Thickness(10),
Children =
{
new Label
{
Text = "Loja Virtual",
FontSize = 24,
HorizontalOptions = LayoutOptions.Center,
TextColor = Colors.Black
}
}
};
}
private StackLayout CreateBody()
{
return new StackLayout
{
Spacing = 20,
Padding = new Thickness(10),
Children =
{
CreateProductSection("Promoções", Colors.LightPink),
CreateProductSection("Novidades", Colors.LightBlue),
CreateProductSection("Mais Vendidos", Colors.LightGreen)
}
};
}
private StackLayout CreateFooter()
{
return new StackLayout
{
BackgroundColor = Colors.LightGray,
Padding = new Thickness(10),
Children =
{
new Label
{
Text = "© 2025 Loja Virtual - Todos os direitos reservados",
FontSize = 14,
HorizontalOptions = LayoutOptions.Center,
TextColor = Colors.Black
}
}
};
}
private StackLayout CreateProductSection(string title, Color backgroundColor)
{
return new StackLayout
{
BackgroundColor = backgroundColor,
Padding = new Thickness(10),
Children =
{
new Label
{
Text = title,
FontSize = 18,
FontAttributes = FontAttributes.Bold,
TextColor = Colors.White
},
new Label
{
Text = "Lista de produtos aqui...",
TextColor = Colors.White
}
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment