private View GetHeaderLayout(MasterSample sample, MultiPage<ContentPage> mainPage, ContentPage rootPage) { var stackLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HeightRequest = 100, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("#FF1196CD"), }; var controlIcon = new Image { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, //Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("Icons/back.png") }; stackLayout.Children.Add(controlIcon); var tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += (sender, args) => { mainPage.Children.Clear(); mainPage.Children.Add(rootPage); if(listView != null) listView.SelectedItem = sample.Samples[0]; }; controlIcon.GestureRecognizers.Add(tapGesture); stackLayout.Children.Add(new Label { TextColor = Color.White, Text = sample.Title, FontSize = 40, VerticalOptions = LayoutOptions.Center }); optionsImage = new Image { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.EndAndExpand, Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("Icons/options.png") }; tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += tapGesture_Tapped; optionsImage.GestureRecognizers.Add(tapGesture); return stackLayout; }
public MasterSamplePageWindows(MasterSample sample, MultiPage<ContentPage> mainPage, ContentPage rootPage) { propertyStackLayout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("#FFEDEDEB"), Padding = new Thickness(10,0,10,10) }; var headerStackLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HeightRequest = 50, HorizontalOptions = LayoutOptions.FillAndExpand, }; var optionsLabel = new Label { TextColor = Color.FromHex("#1196CD"), Text = "Options", FontSize = 20, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; headerStackLayout.Children.Add(optionsLabel); //AbsoluteLayout.SetLayoutBounds(optionsLabel,); var optionsHeaderImage = new Image { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.EndAndExpand, Aspect = Aspect.AspectFit, Source = ImageSource.FromFile("Icons/optionBack.png") }; var tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += tapGesture_Tapped; optionsHeaderImage.GestureRecognizers.Add(tapGesture); headerStackLayout.Children.Add(optionsHeaderImage); propertyStackLayout.Children.Add(headerStackLayout); var mainContent = new StackLayout { Spacing = 0 }; headerView = GetHeaderLayout(sample, mainPage, rootPage); mainContent.Children.Add(headerView); mainContent.Children.Add(GetControlLayout(sample)); Content = mainContent; }