Skip to content

Create BaseGalleryPage#177

Merged
TheCodeTraveler merged 6 commits intomainfrom
Add-BaseGalleryPage
Nov 9, 2021
Merged

Create BaseGalleryPage#177
TheCodeTraveler merged 6 commits intomainfrom
Add-BaseGalleryPage

Conversation

@TheCodeTraveler
Copy link
Copy Markdown
Collaborator

@TheCodeTraveler TheCodeTraveler commented Oct 30, 2021

Description

This PR creates BaseGalleryPage.cs that can be used for each Gallery Page.

This removes the duplicate code that currently exists in BehaviorGalleryPage and ConvertersGalleryPage, allowing us to easily implement Gallery pages:

public class ConvertersGalleryPage : BaseGalleryPage<ConvertersGalleryViewModel>
{
  public ConvertersGalleryPage() : base("Converters")
  {
  }
}

BaseGalleryPage.cs will make it super easy to add new Gallery pages in the future, like ViewsGalleryPage, ExtensionsGalleryPage, etc.

BaseGalleryPage.cs uses the same style found in the existing gallery pages:

Detailed Solution

  • Add CommunityToolkit.Maui.Markup NuGet Package
  • Create BehaviorsGalleryPage.cs
    • A CollectionView to display BaseGalleryViewModel.Items
    • BehaviorsGalleryPage.cs is implemented using C# Markup Extensions because XAML ContentPages cannot be inherited
  • Remove bottom Padding in MainPage.xaml.cs
    • MainPage uses a ScrollView which needs to extend to the bottom of the page
  • Simplify BehaviorsGalleryPage
    • Inherit from BaseGalleryPage
  • Simplify ConvertersGalleryPage
    • Inherit from BaseGalleryPage

@TheCodeTraveler TheCodeTraveler merged commit df5b45e into main Nov 9, 2021
@delete-merged-branch delete-merged-branch bot deleted the Add-BaseGalleryPage branch November 9, 2021 19:14
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants