diff options
author | Paul DiPietro <pauldipietro@users.noreply.github.com> | 2016-10-20 15:01:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-20 15:01:50 -0500 |
commit | 4042f39f0007dd80f6ca3f8273e4cc155cf8123c (patch) | |
tree | 4d9a282508d809645d1c00b05f3d2376c61c1330 /Xamarin.Forms.Controls/GalleryPages/PlatformSpecificsGalleries/TabbedPageAndroid.cs | |
parent | d24f3e5438c300242d553e81817b57045f00bf4f (diff) | |
download | xamarin-forms-4042f39f0007dd80f6ca3f8273e4cc155cf8123c.tar.gz xamarin-forms-4042f39f0007dd80f6ca3f8273e4cc155cf8123c.tar.bz2 xamarin-forms-4042f39f0007dd80f6ca3f8273e4cc155cf8123c.zip |
[Android] Add Platform Specific features for setting TabbedPage swipe paging and OffscreenPageLimit (#409)
* [Android] Add Platform Specific feature for setting TabbedPage swipe paging
* [Android] Add Platform Specific feature for OffscreenPageLimit
* Update docs
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; + } + } +} |