Пример #1
0
        StackLayout BuildListView(RootPageViewModel viewModel)
        {
            var headerTemplate = new DataTemplate(typeof(ModuleMediaListHeaderTemplate));

            headerTemplate.CreateContent();

            var itemTemplate = new DataTemplate(typeof(ModuleMediaListItemTemplate));

            itemTemplate.CreateContent();

            _listView = new ListView
            {
                ItemsSource         = viewModel.MediaSections,
                IsGroupingEnabled   = true,
                GroupDisplayBinding = new Binding("SectionName"),
                HasUnevenRows       = false,
                GroupHeaderTemplate = headerTemplate,
                ItemTemplate        = itemTemplate
            };

            return(new StackLayout {
                Children = { _listView }
            });
        }
Пример #2
0
        protected override void Init()
        {
            var vm = new RootPageViewModel();

            Content = BuildListView(vm);
        }