diff options
Diffstat (limited to 'Xamarin.Forms.Controls/GalleryPages/PlatformSpecificsGalleries/TabbedPageAndroid.cs')
-rw-r--r-- | Xamarin.Forms.Controls/GalleryPages/PlatformSpecificsGalleries/TabbedPageAndroid.cs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/GalleryPages/PlatformSpecificsGalleries/TabbedPageAndroid.cs b/Xamarin.Forms.Controls/GalleryPages/PlatformSpecificsGalleries/TabbedPageAndroid.cs new file mode 100644 index 00000000..ab1904a4 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/PlatformSpecificsGalleries/TabbedPageAndroid.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; +using Xamarin.Forms.PlatformConfiguration; +using Xamarin.Forms.PlatformConfiguration.AndroidSpecific; + +namespace Xamarin.Forms.Controls.GalleryPages.PlatformSpecificsGalleries +{ + public class TabbedPageAndroid : TabbedPage + { + public TabbedPageAndroid(ICommand restore) + { + Children.Add(CreateFirstPage(restore)); + Children.Add(CreateAdditonalPage()); + Children.Add(CreateAdditonalPage()); + Children.Add(CreateAdditonalPage()); + Children.Add(CreateAdditonalPage()); + On<Android>().SetOffscreenPageLimitProperty(2); + } + + ContentPage CreateFirstPage(ICommand restore) + { + var page = new ContentPage { Title = "Content Page Title" }; + var offscreenPageLimit = new Label(); + var content = new StackLayout + { + VerticalOptions = LayoutOptions.Fill, + HorizontalOptions = LayoutOptions.Fill, + Children = + { + new Button + { + Text = "Click to Toggle Swipe Paging", + Command = new Command(() => On<Android>().SetIsSwipePagingEnabled(!On<Android>().IsSwipePagingEnabled())) + }, + offscreenPageLimit + } + }; + + var restoreButton = new Button { Text = "Back To Gallery" }; + restoreButton.Clicked += (sender, args) => restore.Execute(null); + content.Children.Add(restoreButton); + + page.Content = content; + + return page; + } + + static Page CreateAdditonalPage() + { + var cp = new ContentPage { Title = "Additional Page" }; + + cp.Content = new StackLayout + { + VerticalOptions = LayoutOptions.Fill, + HorizontalOptions = LayoutOptions.Fill, + Children = + { + new Entry + { + Placeholder = "Enter some text" + } + } + }; + + return cp; + } + } +} |