Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public HeaderFooterGallery()
descriptionLabel,
TestBuilder.NavButton("Header/Footer (String)", () => new HeaderFooterString(), Navigation),
TestBuilder.NavButton("Header/Footer (Forms View)", () => new HeaderFooterView(), Navigation),
TestBuilder.NavButton("Header/Footer (Horizontal Forms View)", () => new HeaderFooterViewHorizontal(), Navigation),
TestBuilder.NavButton("Header/Footer (Template)", () => new HeaderFooterTemplate(), Navigation),
TestBuilder.NavButton("Header/Footer (Grid)", () => new HeaderFooterGrid(), Navigation),
TestBuilder.NavButton("Footer Only (String)", () => new FooterOnlyString(), Navigation),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class=" Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries.HeaderFooterViewHorizontal">
<ContentPage.Content>
<Grid ColumnDefinitions="*,*" RowDefinitions="Auto,*">
<Button Text="Add 2 Items" Grid.Row="0" Grid.Column="0" HorizontalOptions="Center"
Command="{Binding AddCommand}" />
<Button Text="Clear All Items" Grid.Row="0" Grid.Column="1" HorizontalOptions="Center"
Command="{Binding ClearCommand}" />

<CollectionView Grid.Row="1" Grid.ColumnSpan="2" x:Name="CollectionView" AutomationId="CV" ItemsSource="{Binding Items}">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" />
</CollectionView.ItemsLayout>

<CollectionView.Header>
<Grid WidthRequest="160">
<Image Source="oasis.jpg" Aspect="AspectFill"></Image>
<Label Text="{Binding HeaderText}" TextColor="AntiqueWhite"
VerticalOptions="Center" LineBreakMode="WordWrap"
HorizontalTextAlignment="Center" Rotation="10"
FontAttributes="Bold" FontSize="20" />
</Grid>
</CollectionView.Header>

<CollectionView.Footer>
<Grid WidthRequest="160">
<Image Source="cover1.jpg" Aspect="AspectFill"></Image>
<Label Text="{Binding FooterText}" TextColor="AntiqueWhite"
HorizontalTextAlignment="Center" Rotation="10"
VerticalOptions="Center" LineBreakMode="WordWrap"
FontAttributes="Bold" FontSize="20" />
</Grid>
</CollectionView.Footer>

</CollectionView>
</Grid>
</ContentPage.Content>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Windows.Input;

namespace Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries
{
public partial class HeaderFooterViewHorizontal : ContentPage
{
readonly HeaderFooterViewModel _viewModel = new HeaderFooterViewModel(10);

public HeaderFooterViewHorizontal()
{
InitializeComponent();

CollectionView.ItemTemplate = ExampleTemplates.PhotoTemplate();
BindingContext = _viewModel;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ public void HeaderFooterViewWorks()
App.WaitForElement("This Is A Footer");
}

[Test]
[Category(UITestCategories.CollectionView)]
public void HeaderFooterHorizontalViewWorks()
{
// Navigate to the selection galleries
VisitInitialGallery("Header Footer");

// Navigate to the specific sample inside selection galleries
VisitSubGallery("Header/Footer (Horizontal Forms View)");

// Verify the header is visible
App.WaitForElement("This Is A Header");

// Scroll right to ensure the footer is visible and positioned at the end
for (int i = 0; i < 5; i++)
{
App.ScrollRight("CV", ScrollStrategy.Auto, 0.9, 250);
}

// Verify the footer is visible
App.WaitForElement("This Is A Footer");
}

[Test]
[Category(UITestCategories.CollectionView)]
public void HeaderFooterTemplateWorks()
Expand Down
Loading