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.Core | |
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.Core')
-rw-r--r-- | Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/TabbedPage.cs | 69 | ||||
-rw-r--r-- | Xamarin.Forms.Core/Xamarin.Forms.Core.csproj | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/TabbedPage.cs b/Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/TabbedPage.cs new file mode 100644 index 00000000..5cec97eb --- /dev/null +++ b/Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/TabbedPage.cs @@ -0,0 +1,69 @@ +namespace Xamarin.Forms.PlatformConfiguration.AndroidSpecific +{ + using FormsElement = Forms.TabbedPage; + + public static class TabbedPage + { + public static readonly BindableProperty IsSwipePagingEnabledProperty = + BindableProperty.Create("IsSwipePagingEnabled", typeof(bool), + typeof(TabbedPage), true); + + public static bool GetIsSwipePagingEnabled(BindableObject element) + { + return (bool)element.GetValue(IsSwipePagingEnabledProperty); + } + + public static void SetIsSwipePagingEnabled(BindableObject element, bool value) + { + element.SetValue(IsSwipePagingEnabledProperty, value); + } + + public static bool IsSwipePagingEnabled(this IPlatformElementConfiguration<Android, FormsElement> config) + { + return GetIsSwipePagingEnabled(config.Element); + } + + public static IPlatformElementConfiguration<Android, FormsElement> SetIsSwipePagingEnabled(this IPlatformElementConfiguration<Android, FormsElement> config, bool value) + { + SetIsSwipePagingEnabled(config.Element, value); + return config; + } + + public static IPlatformElementConfiguration<Android, FormsElement> EnableSwipePaging(this IPlatformElementConfiguration<Android, FormsElement> config) + { + SetIsSwipePagingEnabled(config.Element, true); + return config; + } + + public static IPlatformElementConfiguration<Android, FormsElement> DisableSwipePaging(this IPlatformElementConfiguration<Android, FormsElement> config) + { + SetIsSwipePagingEnabled(config.Element, false); + return config; + } + + public static readonly BindableProperty OffscreenPageLimitProperty = + BindableProperty.Create("OffscreenPageLimit", typeof(int), + typeof(TabbedPage), 3, validateValue: (binding, value) => (int)value >= 0); + + public static int GetOffscreenPageLimitProperty(BindableObject element) + { + return (int)element.GetValue(OffscreenPageLimitProperty); + } + + public static void SetOffscreenPageLimitProperty(BindableObject element, int value) + { + element.SetValue(OffscreenPageLimitProperty, value); + } + + public static int OffscreenPageLimit(this IPlatformElementConfiguration<Android, FormsElement> config) + { + return GetOffscreenPageLimitProperty(config.Element); + } + + public static IPlatformElementConfiguration<Android, FormsElement> SetOffscreenPageLimitProperty(this IPlatformElementConfiguration<Android, FormsElement> config, int value) + { + SetOffscreenPageLimitProperty(config.Element, value); + return config; + } + } +} diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj index 777e85e3..05e0bf85 100644 --- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj +++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj @@ -89,6 +89,7 @@ <Compile Include="EnumerableExtensions.cs" /> <Compile Include="PlatformConfiguration\AndroidSpecific\AppCompat\Application.cs" /> <Compile Include="PlatformConfiguration\AndroidSpecific\Application.cs" /> + <Compile Include="PlatformConfiguration\AndroidSpecific\TabbedPage.cs" /> <Compile Include="PlatformConfiguration\ExtensionPoints.cs" /> <Compile Include="PlatformConfiguration\iOSSpecific\BlurEffectStyle.cs" /> <Compile Include="PlatformConfiguration\iOSSpecific\NavigationPage.cs" /> |