Exemple #1
0
    public MainPage()
    {
        MapControl.Map?.Layers.Add(OpenStreetMap.CreateTileLayer());

        Content = new Grid
        {
            ColumnDefinitions =
            {
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Auto)
                },
                new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                }
            },
            Children =
            {
                new VerticalStackLayout()
                {
                    Spacing  = 20,
                    Children =
                    {
                        SampleCategoryPicker,
                        SampleList
                    }
                }.Column(0).Padding(20),
                MapControl.Column(1)
            }
        };

        SampleList.ItemSelected += SampleList_ItemSelected;

        allSamples = AllSamples.GetSamples() ?? new List <ISampleBase>();
        var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

        SampleCategoryPicker !.ItemsSource         = categories.ToList <string>();
        SampleCategoryPicker.SelectedIndexChanged += SampleCategoryPicker_SelectedIndexChanged;;
        SampleCategoryPicker.SelectedItem          = "Info";
    }