The last control presented in this chapter is the hub that presents a collection of sections. It can also be supported by the data binding mechanism, as explained in this recipe.
As an example, you will create a page with a scrollable photo gallery. Each photo is presented as a separate hub section with a given header.
To step through this recipe, you need the automatically generated project configured according to the MVVM design pattern, as described in the Creating the view model for a page recipe.
To bind a collection to a hub, in order to create a page with a scrollable photo gallery, perform the following steps:
Add the
G01.jpg
,G02.jpg
,G03.jpg
, andG04.jpg
files (representing some images in the gallery) to theAssets
directory.Add the
GalleryItemViewModel
class, which represents the data of a single gallery item, to theGalleryItemViewModel.cs
file in theViewModels
folder. The class contains two properties (Title
andImageUrl...