IView CreateContainer(string title, View content) { var contentContainer = new StackLayout(); contentContainer.SetAppThemeColor(BackgroundColorProperty, SampleColors.LightSectionBackgroundColor, SampleColors.DarkSectionBackgroundColor); var header = new Label { Padding = 12, TextColor = SampleColors.LightTextColor, Text = title }; header.SetAppThemeColor(BackgroundColorProperty, SampleColors.LightSectionHeaderBackgroundColor, SampleColors.DarkSectionHeaderBackgroundColor); header.SetAppThemeColor(Label.TextColorProperty, SampleColors.LightTextColor, SampleColors.DarkTextColor); contentContainer.Children.Add(header); contentContainer.Children.Add(content); var container = new Grid { Padding = 0, Margin = new Thickness(0, 6) }; container.SetAppThemeColor(BackgroundColorProperty, SampleColors.LightSectionBackgroundColor, SampleColors.DarkSectionBackgroundColor); container.Children.Add(contentContainer); return(container); }