I currently got databinding to work on a collection view to show all my buttons.
However since my collection List has over 24 items in it, I want to add four buttons (Appetizer, Breakfast, Lunch, Dinner) on the same page and filter based on which one I clicked. That way i only show only a few of those selections at a time.
Should I handle this in the ViewModel? Or is should this be a responsibility for the pageview?
MenuItem class:
public enum type
{
Appetizer,
Breakfast,
Lunch,
Dinner
};
class MenuItem
{
//stuff
}
MenuItemsPage:
public sealed partial class MenuItemsPage : Page
{
public MenuItemsPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
string tableName = e.Parameter as string;
this.DataContext = new MenuPageVM(tableName); //this returns List<MenuItem> 24 items. All 4 types of MenuItems
}
}
}
XAML:
<CollectionViewSource x:Key="MenuItemsCollectionViewSource" Source="{Binding MenuItems}"/>
<GridView SelectionMode="None"
x:Name="menuGrid" ItemsSource="{Binding Mode=OneTime, Source={StaticResource MenuItemsCollectionViewSource}}" Margin="256,113,320,184"
ItemTemplate="{StaticResource MenuButtonTemplate}"/>