Grid Menu with Flow List View

I’m currently working in a project that require me to create a grid menu. In my previous project, I manually created it using grid, but later I found out a more effective way to create grid menu. I’m using third party library, created by the infamous Daniel Luberda, called Flow List View. Unlike the default list view which only has one column, flow list view allow you to set how many columns you want for your list view. In this post I want to discuss about how basically we can utilize this flow list view with MVVM pattern.

Selected Item Handling

When you create a menu for your app, there are, at least, two things you have to handle. First, how it handles user input and second how to navigate to other pages. To handle user input, you can see the following xaml code to get glimpse how it’ll be done.






Take a look once again at Flow List View. As you can see it has several properties, two of them are Flow Last Tapped Item and Flow Item Tapped Command. Base on it’s name, you can guess the function of those properties. You can bind the menu item that user just tapped to Flow Last Tapped Item, and then Flow Item Tapped Command will execute the command to handle the tapped event. So, when user tap one of the menus, we can record what menu he just tapped and do action accordingly. Another important property is Flow Column Count, where you set how many column your menu will be.

Navigation Handling

After we’ve done doing binding in xaml file, we move on to the view model. In view model, to navigate to another page, we’ll need INavigation from the class binder. We’ll pass it from constructor and use it to navigate to other page depend on the tapped menu. The following codes are the example how I did it.


public class BreakfastViewModel : INotifyPropertyChanged
  public event PropertyChangedEventHandler PropertyChanged;
  private INavigation navigation;
  private ObservableCollection breakfastMenuList;
  private BreakfastMenu selectedBreakfastMenu;
  public ObservableCollection BreakfastMenuList
   get => breakfastMenuList;
   set => SetObservableProperty(ref breakfastMenuList, value);
  public BreakfastMenu SelectedBreakfastMenu
   get => selectedBreakfastMenu;
   set => SetObservableProperty(ref selectedBreakfastMenu, value);

  public ICommand MenuTappedCommand { get; set; }

  public BreakfastViewModel(INavigation navigation)
   this.navigation = navigation;
   BreakfastMenuList = new ObservableCollection()
     new BreakfastMenu() { ImageSource = "Burger.png", MenuTitle = "BURGER" },
     new BreakfastMenu() { ImageSource = "Pizza.png", MenuTitle = "PIZZA" },
     new BreakfastMenu() { ImageSource = "EggBacon.png", MenuTitle = "BACON" },
     new BreakfastMenu() { ImageSource = "Sandwich.png", MenuTitle = "SANDWICH" },
   MenuTappedCommand = new Command(async () => await MenuSelectedAsync());

private async Task MenuSelectedAsync()
 switch (SelectedBreakfastMenu.MenuTitle)
  case "BURGER":
   await navigation.PushModalAsync(new BreakfastBurger());
  case "PIZZA":
   await navigation.PushModalAsync(new BreakfastPizza());
  case "BACON":
   await navigation.PushModalAsync(new BreakfastBacon());
  case "SANDWICH":
   await navigation.PushModalAsync(new BreakfastSandwich());


protected void SetObservableProperty(ref T field, T value,
[CallerMemberName] string propertyName = "")
  if (EqualityComparer.Default.Equals(field, value)) return;
  field = value;

protected virtual void OnPropertyChanged(string propertyName)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));


public partial class BreakfastPage : ContentPage
 public BreakfastPage()
   BindingContext = new BreakfastViewModel(Navigation);

If there’s anything you need to pay more attention is, how I navigate. I used PushModalAsync instead of, the more commonly used, PushAsync, because PushAsync is not supported globally to be used in view model.


  • Icon from FlatIcon, Burger icon by Freepik, Pizza icon by Smashicons, EggBacon and Sandwich Icon by Twitter
  • Flow List View by Daniel Luberda (github)

4 thoughts on “Grid Menu with Flow List View

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s