public App() { ListView listView; var listPage = new ContentPage { Content = listView = new ListView(), Title = "Skia Demo", }; NavigationPage navPage; MainPage = navPage = new NavigationPage(listPage) { BarBackgroundColor = new Xamarin.Forms.Color(0x34 / 255.0, 0x98 / 255.0, 0xdb / 255.0), BarTextColor = Xamarin.Forms.Color.White, }; listView.ItemsSource = Demos.SamplesForPlatform(Demos.Platform.iOS | Demos.Platform.Android); listView.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; } listView.SelectedItem = null; navPage.PushAsync(new ContentPage { Content = new SkiaView(SkiaSharp.Demos.MethodForSample(e.SelectedItem.ToString())), }); }; }
public App() { var items = Device.OS == TargetPlatform.iOS ? Demos.SamplesForPlatform(Demos.Platform.iOS) : Device.OS == TargetPlatform.Android ? Demos.SamplesForPlatform(Demos.Platform.Android) : Device.OS == TargetPlatform.Windows ? Demos.SamplesForPlatform(Demos.Platform.UWP) : Demos.SamplesForPlatform(Demos.Platform.All); var masterDetail = new MasterDetailPage { IsGestureEnabled = true, MasterBehavior = MasterBehavior.Popover }; var detailPage = new DetailsPage(items.First()); var navPage = new NavigationPage(detailPage) { BarBackgroundColor = XamarinBlue, BarTextColor = Color.White, }; var masterPage = new MasterPage(items, demo => { masterDetail.IsPresented = false; detailPage.SetDemo(demo); navPage.Title = demo; }); if (Device.OS == TargetPlatform.iOS) { masterPage.Icon = "hamburger.png"; } masterDetail.Master = masterPage; masterDetail.Detail = navPage; MainPage = masterDetail; masterDetail.IsPresented = true; }