summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 20:02:25 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-03-22 23:13:41 (GMT)
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls')
-rw-r--r--Xamarin.Forms.Controls/App.cs321
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/AppearingGalleryPage.cs129
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/AutomationIDGallery.cs104
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml37
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml.cs75
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/CellForceUpdateSizeGalleryPage.cs193
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml15
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml.cs36
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/ListRefresh.cs115
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/ListScrollTo.cs93
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/ListViewSelectionColor.cs150
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/NavBarTitleTestPage.cs91
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs27
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/PanGestureGalleryPage.cs96
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/PinchGestureTestPage.cs91
-rw-r--r--Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs55
-rw-r--r--Xamarin.Forms.Controls/Controls/Issue3076Button.cs14
-rw-r--r--Xamarin.Forms.Controls/CoreGallery.cs419
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs39
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/ButtonCoreGalleryPage.cs106
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/CoreBoxViewGalleryPage.cs37
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/CoreGalleryPage.cs185
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/DatePickerCoreGalleryPage.cs34
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/EditorCoreGalleryPage.cs51
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs92
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/FrameCoreGalleryPage.cs36
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/ImageCoreGalleryPage.cs56
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/KeyboardCoreGalleryPage.cs49
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs158
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs268
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/OpenGLViewCoreGalleryPage.cs16
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/PickerCoreGalleryPage.cs35
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/ProgressBarCoreGalleryPage.cs27
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs89
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/SliderCoreGalleryPage.cs29
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/StepperCoreGalleryPage.cs29
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/SwitchCoreGalleryPage.cs25
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/TableViewCoreGalleryPage.cs16
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/TimePickerCoreGalleryPage.cs24
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/WebViewCoreGalleryPage.cs62
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/AbsoluteLayoutGallery.cs151
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ActionSheetGallery.cs64
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/AlertGallery.cs28
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/BackgroundImageGallery.cs109
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/BoundContentPage.cs79
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs115
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CarouselPageGallery.cs76
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CarouselViewGallery.cs292
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellTypeList.cs63
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs54
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs85
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs121
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs68
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs33
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs47
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs65
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs48
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs58
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs34
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs115
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs31
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ControlTemplatePage.cs48
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml24
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml.cs31
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/DisposeGallery.cs58
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/EditableList.cs116
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/EditorGallery.cs132
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/EntryGallery.cs104
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs32
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/GridGallery.cs174
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/GroupedListActionsGallery.cs282
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs244
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ImageGallery.cs71
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ImageLoadingGallery.cs43
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/InputIntentGallery.cs101
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs116
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/LayoutOptionsGallery.cs108
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/LayoutPerformanceGallery.cs116
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/LineBreakModeGallery.cs41
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ListPage.cs117
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs231
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/MapGallery.cs153
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/MasterDetailPageTabletPage.cs40
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/MinimumSizeGallery.cs50
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/MultiGallery.cs58
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs62
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/NavigationMenuGallery.cs38
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/NavigationPropertiesGallery.cs64
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs70
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/PickerGallery.cs45
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ProgressBarGallery.cs26
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/RelativeLayoutGallery.cs47
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ScaleRotate.cs157
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ScrollGallery.cs158
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/SearchBarGallery.cs128
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/SettingsPage.cs57
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/SliderGallery.cs33
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/StackLayoutGallery.cs47
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/StepperGallery.cs49
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/StyleGallery.cs41
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml17
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml.cs15
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/SwitchGallery.cs53
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/TableViewGallery.cs24
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/TemplatedCarouselGallery.cs114
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/TemplatedTabbedGallery.cs169
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ToolbarGallery.cs40
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/UnevenListGallery.cs112
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/WebViewGallery.cs50
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml4
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml.cs13
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/crimson.jpgbin0 -> 79109 bytes
-rw-r--r--Xamarin.Forms.Controls/Helpers/ITestCloudService.cs12
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/Page1.xaml13
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs193
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml34
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs149
-rw-r--r--Xamarin.Forms.Controls/Properties/AssemblyInfo.cs33
-rw-r--r--Xamarin.Forms.Controls/RootPages/CaseTenPage.cs27
-rw-r--r--Xamarin.Forms.Controls/RootPages/Issue465Page.cs28
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootContentPage.cs19
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootMDPNavigationContentPage.cs40
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootMDPNavigationTabbedContentPage.cs49
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootNavigationContentPage.cs26
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootNavigationManyTabbedPage.cs63
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootNavigationTabbedContentPage.cs45
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootTabbedContentPage.cs43
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootTabbedMDPNavigationContentPage.cs57
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootTabbedManyNavigationContentPage.cs77
-rw-r--r--Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs46
-rw-r--r--Xamarin.Forms.Controls/RootPages/SwapHierachyStackLayout.cs69
-rw-r--r--Xamarin.Forms.Controls/RootPages/TabbedNavPage.cs33
-rw-r--r--Xamarin.Forms.Controls/TestCases.cs213
-rw-r--r--Xamarin.Forms.Controls/ViewContainers/EventViewContainer.cs32
-rw-r--r--Xamarin.Forms.Controls/ViewContainers/LayeredViewContainer.cs38
-rw-r--r--Xamarin.Forms.Controls/ViewContainers/MultiBindingHack.cs47
-rw-r--r--Xamarin.Forms.Controls/ViewContainers/StateViewContainer.cs48
-rw-r--r--Xamarin.Forms.Controls/ViewContainers/ValueViewContainer.cs16
-rw-r--r--Xamarin.Forms.Controls/ViewContainers/ViewContainer.cs44
-rw-r--r--Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj285
-rw-r--r--Xamarin.Forms.Controls/app.config11
-rw-r--r--Xamarin.Forms.Controls/packages.config4
142 files changed, 11177 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/App.cs b/Xamarin.Forms.Controls/App.cs
new file mode 100644
index 0000000..53424cc
--- /dev/null
+++ b/Xamarin.Forms.Controls/App.cs
@@ -0,0 +1,321 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Reflection;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class AppLifeCycle : Application
+ {
+ protected override void OnStart ()
+ {
+ base.OnStart ();
+ }
+
+ protected override void OnSleep ()
+ {
+ base.OnSleep ();
+ }
+
+ protected override void OnResume ()
+ {
+ base.OnResume ();
+ }
+
+ public AppLifeCycle ()
+ {
+ MainPage = new ContentPage {
+ Content = new Label {
+ Text = "Testing Lifecycle events"
+ }
+ };
+ }
+ }
+
+ public class SimpleApp : Application
+ {
+ Label label;
+
+ public SimpleApp ()
+ {
+ label = new Label { VerticalOptions = LayoutOptions.CenterAndExpand };
+
+ if (Current.Properties.ContainsKey ("LabelText")) {
+ label.Text = (string) Current.Properties["LabelText"] + " Restored!";
+ Debug.WriteLine ("Initialized");
+ } else {
+ Current.Properties["LabelText"] = "Wowza";
+ label.Text = (string) Current.Properties["LabelText"] + " Set!";
+ Debug.WriteLine ("Saved");
+ }
+
+ MainPage = new ContentPage {
+ Content = new StackLayout {
+ Children = {
+ label
+ }
+ }
+ };
+
+ SerializeProperties ();
+ }
+
+ async void SerializeProperties ()
+ {
+ await Current.SavePropertiesAsync ();
+ }
+ }
+
+ public class App : Application
+ {
+ public string InsightsApiKey = Secrets["InsightsApiKey"];
+ public const string AppName = "XamarinFormsControls";
+ public const string AppVersion = "1.4.3";
+ public static int IOSVersion = -1;
+ readonly ITestCloudService _testCloudService;
+ // make sure serialized data is available here
+
+ //protected override void OnStart ()
+ //{
+ // // called right after property store is populated
+ // MainPage.BackgroundColor = Color.Green;
+ // Current.Properties["TimesStarted"] = ((int)Current.Properties["TimesStarted"]) + 1;
+ // ((MainPageLifeCycleTests)MainPage).UpdateLabels ();
+ //}
+
+ //protected override void OnResume ()
+ //{
+ // MainPage.BackgroundColor = Color.White;
+ // Current.Properties["TimesResumed"] = ((int)Current.Properties["TimesResumed"]) + 1;
+ // ((MainPageLifeCycleTests)MainPage).UpdateLabels ();
+ //}
+
+ //protected override void OnSleep ()
+ //{
+ // MainPage.BackgroundColor = Color.Red;
+ // Current.Properties["TimesSlept"] = ((int)Current.Properties["TimesSlept"]) + 1;
+ // ((MainPageLifeCycleTests)MainPage).UpdateLabels ();
+ //}
+ public static List<string> AppearingMessages = new List<string>();
+
+ public static ContentPage MenuPage { get; set; }
+
+
+
+ public App ()
+ {
+ _testCloudService = DependencyService.Get<ITestCloudService> ();
+ InitInsights ();
+ // MainPage = new MainPageLifeCycleTests ();
+ MainPage = new MasterDetailPage () {
+ Master = new ContentPage { Title = "Master", BackgroundColor = Color.Red },
+ Detail = CoreGallery.GetMainPage ()
+ };
+ }
+
+ public void SetMainPage (Page rootPage)
+ {
+ MainPage = rootPage;
+ }
+
+ void InitInsights ()
+ {
+ if (Insights.IsInitialized) {
+ Insights.ForceDataTransmission = true;
+ if (_testCloudService != null && _testCloudService.IsOnTestCloud ())
+ Insights.Identify (_testCloudService.GetTestCloudDevice (), "Name", _testCloudService.GetTestCloudDeviceName ());
+ else
+ Insights.Identify ("DemoUser", "Name", "Demo User");
+ }
+ }
+
+ public static Assembly GetAssembly (out string assemblystring)
+ {
+ assemblystring = typeof(App).AssemblyQualifiedName.Split (',')[1].Trim ();
+ var assemblyname = new AssemblyName (assemblystring);
+ return Assembly.Load (assemblyname);
+ }
+
+ public static async Task<string> LoadResource (string filename)
+ {
+ string assemblystring;
+ Assembly assembly = GetAssembly (out assemblystring);
+
+ Stream stream = assembly.GetManifestResourceStream ($"{assemblystring}.{filename}");
+ string text;
+ using (var reader = new StreamReader (stream)) {
+ text = await reader.ReadToEndAsync ();
+ }
+ return text;
+ }
+
+ public static void InitSecrets ()
+ {
+ secrets = new Dictionary<string, string> ();
+
+ string keyData = LoadResource ("secrets.txt").Result;
+ string[] entries = keyData.Split ("\n\r".ToCharArray (), StringSplitOptions.RemoveEmptyEntries);
+ foreach (string entry in entries) {
+ string[] parts = entry.Split (':');
+ if (parts.Length < 2) {
+ continue;
+ }
+
+ secrets.Add (parts[0].Trim (), parts[1].Trim ());
+ }
+ }
+
+ private static Dictionary<string, string> secrets;
+
+ public static Dictionary<string, string> Secrets
+ {
+ get
+ {
+ if (secrets == null) {
+ InitSecrets ();
+ }
+
+ return secrets;
+ }
+ }
+ }
+
+ // Not quite sure how to turn this into a test case, effectively replace the normal Application with this to repro issues reported.
+ // Full repro requires assignment to MainPage, hence the issue
+ public class NavReproApp : Application
+ {
+ NavigationPage navPage1 = new NavigationPage ();
+
+ public NavReproApp ()
+ {
+
+ var btn = new Button () { Text = "Start" };
+
+ btn.Clicked += Btn_Clicked;
+
+ navPage1.PushAsync (new ContentPage () { Content = btn });
+
+ MainPage = navPage1;
+
+ }
+
+ async void Btn_Clicked (object sender, EventArgs e)
+ {
+ await navPage1.PushAsync (new ContentPage () { Content = new Label () { Text = "Page 2" } });
+ await navPage1.PushAsync (new ContentPage () { Content = new Label () { Text = "Page 3" } });
+
+
+ var navPage2 = new NavigationPage ();
+
+ var btn = new Button () { Text = "Start Next" };
+ btn.Clicked += Btn_Clicked1;
+
+ await navPage2.PushAsync (new ContentPage () { Content = btn });
+
+ MainPage = navPage2;
+
+
+ }
+
+ async void Btn_Clicked1 (object sender, EventArgs e)
+ {
+ MainPage = navPage1;
+ await navPage1.PopAsync ();
+
+
+ await navPage1.PushAsync (new ContentPage () { Content = new Label () { Text = "Page 3a" } });
+ }
+
+ protected override void OnStart ()
+ {
+ // Handle when your app starts
+ }
+
+ protected override void OnSleep ()
+ {
+ // Handle when your app sleeps
+ }
+
+ protected override void OnResume ()
+ {
+ // Handle when your app resumes
+ }
+ }
+
+ public class MainPageLifeCycleTests : ContentPage
+ {
+ int numTimesStarted;
+ int numTimesSlept;
+ int numTimesResumed;
+
+ StackLayout numTimesStartedLayout;
+ StackLayout numTimesSleptLayout;
+ StackLayout numTimesResumedLayout;
+
+ public MainPageLifeCycleTests ()
+ {
+ object timesStarted;
+ if (!Application.Current.Properties.TryGetValue ("TimesStarted", out timesStarted)) {
+ Application.Current.Properties["TimesStarted"] = 0;
+ }
+ var numTimesStarted = (int)Application.Current.Properties["TimesStarted"];
+
+
+ object timesSlept;
+ if (!Application.Current.Properties.TryGetValue ("TimesSlept", out timesSlept)) {
+ Application.Current.Properties["TimesSlept"] = 0;
+ }
+ var numTimesSlept = (int)Application.Current.Properties["TimesSlept"];
+
+
+ object timesResumed;
+ if (!Application.Current.Properties.TryGetValue ("TimesResumed", out timesResumed)) {
+ Application.Current.Properties["TimesResumed"] = 0;
+ }
+ var numTimesResumed = (int)Application.Current.Properties["TimesResumed"];
+
+ numTimesStartedLayout = BuildLabelLayout ("TimesStarted", numTimesStarted);
+ numTimesSleptLayout = BuildLabelLayout ("TimesSlept", numTimesSlept);
+ numTimesResumedLayout = BuildLabelLayout ("TimesResumed", numTimesResumed);
+
+ var layout = new StackLayout {
+ Children = {
+ numTimesStartedLayout,
+ numTimesSleptLayout,
+ numTimesResumedLayout
+ }
+ };
+
+ Content = layout;
+ }
+
+ StackLayout BuildLabelLayout (string title, int property)
+ {
+ var labelTitle = new Label {
+ Text = title
+ };
+
+ var valueLabel = new Label {
+ Text = property.ToString ()
+ };
+
+ return new StackLayout {
+ Children = {
+ labelTitle,
+ valueLabel
+ }
+ };
+ }
+
+ public void UpdateLabels ()
+ {
+ ((Label)numTimesStartedLayout.Children[1]).Text = ((int)Application.Current.Properties["TimesStarted"]).ToString ();
+ ((Label)numTimesSleptLayout.Children[1]).Text = ((int)Application.Current.Properties["TimesSlept"]).ToString ();
+ ((Label)numTimesResumedLayout.Children[1]).Text = ((int)Application.Current.Properties["TimesResumed"]).ToString ();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/AppearingGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/AppearingGalleryPage.cs
new file mode 100644
index 0000000..0df2eeb
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/AppearingGalleryPage.cs
@@ -0,0 +1,129 @@
+using System;
+
+using Xamarin.Forms;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms.Controls
+{
+ public class AppearingGalleryPage : ContentPage
+ {
+ const string NavPageTitle = "NavAppearingPage";
+ const string MasterPageTitle = "MasterAppearingPage";
+ const string TabbedPageTitle = "TabbedAppearingPage";
+ const string CarouselPageTitle = "CarouselAppearingPage";
+
+ public AppearingGalleryPage ()
+ {
+ var initalPage = new AppearingPage (1);
+ var initalPage2 = new AppearingPage (2);
+
+ Content = new StackLayout {
+ Children = {
+ new Button { Text = NavPageTitle, Command = new Command (() => {
+ Application.Current.MainPage = new NavAppearingPage(initalPage);
+ })
+ },
+ new Button { Text = MasterPageTitle, Command = new Command (() => {
+ var page = new MasterDetailPage {
+ Title = MasterPageTitle,
+ Master = new ContentPage { Title = "Master", BackgroundColor = Color.Red },
+ Detail = new NavAppearingPage(initalPage)
+ };
+ SetMainPage (page);
+ })
+ },
+ new Button { Text = TabbedPageTitle, Command = new Command (() => {
+ var page = new TabbedPage {
+ Title = TabbedPageTitle,
+ Children = { initalPage, initalPage2 }
+ };
+ SetMainPage (page);
+ })
+ },
+ new Button { Text = CarouselPageTitle, Command = new Command (() => {
+
+ var page = new CarouselPage {
+ Title = CarouselPageTitle,
+ Children = { initalPage, initalPage2 }
+ };
+ SetMainPage (page);
+ })
+ }
+ }
+ };
+ }
+
+ static void SetMainPage (Page page)
+ {
+ var tracker = new AppearingTracker (page);
+ Application.Current.MainPage = page;
+ }
+
+ class AppearingTracker
+ {
+ int _isAppearingFired;
+ int _isDisappearingFired;
+
+ public AppearingTracker (Page page)
+ {
+ page.Appearing += (object sender, EventArgs e) => {
+ _isAppearingFired++;
+ App.AppearingMessages.Add ($"Appearing {page.Title}");
+ Debug.WriteLine ($"Appearing {page.Title}");
+ };
+
+ page.Disappearing += (object sender, EventArgs e) => {
+ _isDisappearingFired++;
+ App.AppearingMessages.Add ($"Disappearing {page.Title}");
+ Debug.WriteLine( $"Disappearing {page.Title}");
+ };
+ }
+ }
+
+ class AppearingPage : ContentPage
+ {
+ int _theId;
+ ListView _listMessages;
+ public AppearingPage (int id)
+ {
+ var tracker = new AppearingTracker (this);
+ _listMessages = new ListView ();
+ _theId = id;
+ Title = $"Page {_theId}";
+ Padding = new Thickness (20);
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = $"Hello Appearing {_theId} page" },
+ new Button { Text = "Push new Page", Command = new Command ( async () => { await Navigation.PushAsync( new AppearingPage(2)); }) },
+ new Button { Text = "Pop page", Command = new Command ( async () => { await Navigation.PopAsync(); }) },
+ new Button { Text = "Pop to root", Command = new Command ( async () => { await Navigation.PopToRootAsync(); }) },
+ new Button { Text = "Change Main Page", Command = new Command ( () => {
+ App.AppearingMessages.Clear();
+ Application.Current.MainPage = new AppearingPage(3); })
+ },
+ _listMessages
+ }
+ };
+ }
+ protected override void OnAppearing ()
+ {
+ base.OnAppearing ();
+ Device.StartTimer (new TimeSpan (200), () => {
+ _listMessages.ItemsSource = App.AppearingMessages;
+ return false;
+ });
+ }
+ }
+
+ class NavAppearingPage : NavigationPage
+ {
+ public NavAppearingPage (Page page) : base(page)
+ {
+ Title = NavPageTitle;
+ var tracker = new AppearingTracker (this);
+ }
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/AutomationIDGallery.cs b/Xamarin.Forms.Controls/ControlGalleryPages/AutomationIDGallery.cs
new file mode 100644
index 0000000..c93a9b6
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/AutomationIDGallery.cs
@@ -0,0 +1,104 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ public class AutomationIdGallery : ContentPage
+ {
+
+ public AutomationIdGallery ()
+ {
+ var scrollView = new ScrollView { AutomationId = "scrollMain" };
+ var rootLayout = new StackLayout { AutomationId = "stckMain" };
+
+ var btn = new Button {
+ AutomationId = "btnTest1",
+ Text = "Test1",
+ Command = new Command (async () => await Navigation.PushModalAsync (new TestPage1 ()))
+ };
+
+ var btn2 = new Button {
+ AutomationId = "btnTest2",
+ Text = "Test2",
+ Command = new Command (async () => await Navigation.PushModalAsync (new TestPage2 ()))
+ };
+
+ rootLayout.Children.Add (btn);
+ rootLayout.Children.Add (btn2);
+
+ var toolBarItem = new ToolbarItem { AutomationId = "tbItemHello", Text= "Hello", Command = new Command(async ()=> { await DisplayAlert("Hello","","ok"); }) };
+ var toolBarItem2 = new ToolbarItem { AutomationId = "tbItemHello2", Order= ToolbarItemOrder.Secondary, Text= "Hello2", Command = new Command(async ()=> { await DisplayAlert("Hello2","","ok"); }) };
+
+ ToolbarItems.Add (toolBarItem);
+ ToolbarItems.Add (toolBarItem2);
+
+ scrollView.Content = rootLayout;
+ Content = scrollView;
+ }
+
+ internal class TestPage1 : ContentPage
+ {
+ public TestPage1 ()
+ {
+ var rootLayout = new StackLayout { AutomationId = "stckMain" };
+ var btn = new Button {
+ AutomationId = "popModal",
+ Text = "Pop",
+ Command = new Command (async () => Navigation.PopModalAsync ())
+ };
+ rootLayout.Children.Add (btn);
+ rootLayout.Children.Add (new ActivityIndicator { AutomationId = "actHello", IsRunning = true });
+ rootLayout.Children.Add (new BoxView {
+ AutomationId = "bxvHello",
+ WidthRequest = 40,
+ HeightRequest = 40,
+ BackgroundColor = Color.Red
+ });
+ rootLayout.Children.Add (new Button { AutomationId = "btnHello", Text = "Hello" });
+ rootLayout.Children.Add (new DatePicker { AutomationId = "dtPicker", Date = DateTime.Parse ("01/01/2014") });
+ rootLayout.Children.Add (new TimePicker { AutomationId = "tPicker", Time = new TimeSpan (14, 45, 50) });
+ rootLayout.Children.Add (new Label { AutomationId = "lblHello", Text = "Hello Label" });
+ rootLayout.Children.Add (new Editor { AutomationId = "editorHello", Text = "Hello Editor" });
+ rootLayout.Children.Add (new Entry { AutomationId = "entryHello", Text = "Hello Entry" });
+
+ Content = rootLayout;
+ }
+ }
+
+ internal class TestPage2 : ContentPage
+ {
+ public TestPage2 ()
+ {
+ var rootLayout = new StackLayout { AutomationId = "stckMain" };
+ var btn = new Button {
+ AutomationId = "popModal",
+ Text = "Pop",
+ Command = new Command (async () => Navigation.PopModalAsync ())
+ };
+ rootLayout.Children.Add (btn);
+ rootLayout.Children.Add (new Image { AutomationId = "imgHello", Source = "menuIcon" });
+ rootLayout.Children.Add (new ListView {
+ AutomationId = "lstView",
+ ItemsSource = new string[2] { "one", "two" },
+ HeightRequest = 50
+ });
+ rootLayout.Children.Add (new Picker { AutomationId = "pickerHello", Items = { "one", "two" } });
+ rootLayout.Children.Add (new ProgressBar { AutomationId = "progressHello", Progress = 2 });
+ rootLayout.Children.Add (new SearchBar { AutomationId = "srbHello", Text = "Hello Search" });
+ rootLayout.Children.Add (new Slider { AutomationId = "sliHello", Value = 0.5 });
+ rootLayout.Children.Add (new Stepper { AutomationId = "stepperHello", Value = 5 });
+ rootLayout.Children.Add (new Switch { AutomationId = "switchHello" });
+ rootLayout.Children.Add (new WebView {
+ AutomationId = "webviewHello",
+ WidthRequest = 100,
+ HeightRequest = 50,
+ Source = new UrlWebViewSource { Url = "http://blog.xamarin.com/" }
+ });
+
+ Content = rootLayout;
+ }
+ }
+
+
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml b/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml
new file mode 100644
index 0000000..accd918
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage
+ xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Controls.BehaviorsAndTriggers"
+ xmlns:local="clr-namespace:Xamarin.Forms.Controls;assembly=Xamarin.Forms.Controls"
+ Padding="8">
+ <StackLayout>
+ <Label Text="Type red in the entry below" />
+ <Entry x:Name="entry" BackgroundColor="Lime">
+ <Entry.Triggers>
+ <Trigger TargetType="Entry" Property="Text" Value="red">
+ <Setter Property="Entry.BackgroundColor">
+ <Color>#ff0000</Color>
+ </Setter>
+ <Trigger.EnterActions>
+ <local:HThrob />
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <local:VThrob />
+ </Trigger.ExitActions>
+ </Trigger>
+ <Trigger TargetType="Entry" Property="IsFocused" Value="true">
+ <Setter Property="Entry.BackgroundColor">
+ <Color>#0000ff</Color>
+ </Setter>
+ </Trigger>
+ </Entry.Triggers>
+ </Entry>
+ <Button Text="Click me!">
+ <Button.Behaviors>
+ <local:StopItBehavior />
+ </Button.Behaviors>
+ </Button>
+ <Label BindingContext="{x:Reference entry}" Text="{Binding Path=IsFocused}" />
+ </StackLayout>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml.cs b/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml.cs
new file mode 100644
index 0000000..de9d4d2
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/BehaviorsAndTriggers.xaml.cs
@@ -0,0 +1,75 @@
+using Xamarin.Forms;
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public partial class BehaviorsAndTriggers : ContentPage
+ {
+ public BehaviorsAndTriggers ()
+ {
+ InitializeComponent ();
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ public class Throb : TriggerAction<VisualElement>
+ {
+ bool _horizontal;
+
+ public Throb (bool horizontal)
+ {
+ _horizontal = horizontal;
+ }
+
+ protected override async void Invoke (VisualElement sender)
+ {
+ for (var i=0;i<5;i++){
+ await sender.TranslateTo (_horizontal ? -5:0,!_horizontal ? -5 : 0, 25);
+ await sender.TranslateTo (_horizontal ? 5:0,!_horizontal ? 5: 0, 25);
+ }
+ await sender.TranslateTo (0, 0, 25);
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ public class HThrob : Throb
+ {
+ [Preserve]
+ public HThrob ()
+ : base (true)
+ {
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ public class VThrob : Throb
+ {
+ public VThrob () : base (false)
+ {
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ public class StopItBehavior : Behavior<Button>
+ {
+ protected override void OnAttachedTo (Button bindable)
+ {
+ base.OnAttachedTo (bindable);
+ bindable.Clicked += OnClicked;
+ }
+
+ protected override void OnDetachingFrom (Button bindable)
+ {
+ bindable.Clicked -= OnClicked;
+ base.OnDetachingFrom (bindable);
+ }
+
+ void OnClicked (object sender, EventArgs e)
+ {
+ var button = (Button)sender;
+ button.Text = "Don't do this again";
+ button.IsEnabled = false;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/CellForceUpdateSizeGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/CellForceUpdateSizeGalleryPage.cs
new file mode 100644
index 0000000..35b29d4
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/CellForceUpdateSizeGalleryPage.cs
@@ -0,0 +1,193 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class CellForceUpdateSizeGalleryPage : TabbedPage
+ {
+ public class ViewCellPage : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ public class MyViewCell : ViewCell
+ {
+ public MyViewCell ()
+ {
+ var image = new Image {
+ Source = ImageSource.FromFile ("crimson.jpg"),
+ BackgroundColor = Color.Gray,
+ HeightRequest = 50,
+ VerticalOptions = LayoutOptions.Fill,
+ HorizontalOptions = LayoutOptions.Fill
+ };
+
+ var button = new Button { Text = "+" };
+ button.Clicked += (object sender, EventArgs e) =>
+ {
+ image.HeightRequest = image.Height + 100;
+ ForceUpdateSize ();
+ };
+
+ Tapped += (object sender, EventArgs e) =>
+ {
+ image.HeightRequest = image.Height - 100;
+ ForceUpdateSize ();
+ };
+
+ View = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { image, button } };
+ }
+ }
+
+ public ViewCellPage ()
+ {
+ var listview = new ListView {
+ HasUnevenRows = true,
+ };
+ var items = Enumerable.Range (0, 10);
+ listview.ItemsSource = items;
+ listview.ItemTemplate = new DataTemplate (typeof (MyViewCell));
+ Content = listview;
+ Title = "View Cell";
+ }
+ }
+
+ public class ImageCellPage : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ public class MyImageCell : ImageCell
+ {
+ public MyImageCell ()
+ {
+ ImageSource = ImageSource.FromFile ("crimson.jpg");
+ Height = 20;
+ Command = new Command (() =>
+ {
+ Height += 20;
+ ForceUpdateSize ();
+ });
+ }
+ }
+ public ImageCellPage ()
+ {
+ var listview = new ListView {
+ HasUnevenRows = true,
+ };
+ var items = Enumerable.Range (0, 10);
+ listview.ItemsSource = items;
+ listview.ItemTemplate = new DataTemplate (typeof (MyImageCell));
+ Content = listview;
+ Title = "Image Cell";
+ }
+ }
+
+ public class TextCellPage : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ public class MyTextCell : TextCell
+ {
+ public MyTextCell ()
+ {
+ Text = "I am a TextCell, short and stout.";
+ Height = 20;
+ Command = new Command (() =>
+ {
+ Height += 20;
+ ForceUpdateSize ();
+ });
+ }
+ }
+
+ public TextCellPage ()
+ {
+ var listview = new ListView {
+ HasUnevenRows = true,
+ };
+ var items = Enumerable.Range (0, 10);
+ listview.ItemsSource = items;
+ listview.ItemTemplate = new DataTemplate (typeof (MyTextCell));
+ Content = listview;
+ Title = "Text Cell";
+ }
+ }
+
+ public class EntryCellPage : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ public class MyEntryCell : EntryCell
+ {
+ public MyEntryCell ()
+ {
+ Text = "I am an EntryCell, short and stout.";
+ Height = 20;
+ Tapped += (object sender, EventArgs e) =>
+ {
+ Height += 20;
+ ForceUpdateSize ();
+ };
+ Completed += (object sender, EventArgs e) =>
+ {
+ Height -= 20;
+ ForceUpdateSize ();
+ };
+ }
+ }
+
+ public EntryCellPage ()
+ {
+ var listview = new ListView {
+ HasUnevenRows = true,
+ };
+ var items = Enumerable.Range (0, 10);
+ listview.ItemsSource = items;
+ listview.ItemTemplate = new DataTemplate (typeof (MyEntryCell));
+ Content = listview;
+ Title = "Entry Cell";
+ }
+ }
+
+ public class SwitchCellPage : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ public class MySwitchCell : SwitchCell
+ {
+ public MySwitchCell ()
+ {
+ Text = "I am a SwitchCell, short and stout.";
+ Height = 20;
+ Tapped += (object sender, EventArgs e) =>
+ {
+ Height += 20;
+ ForceUpdateSize ();
+ };
+ OnChanged += (object sender, ToggledEventArgs e) =>
+ {
+ Height -= 20;
+ ForceUpdateSize ();
+ };
+ }
+ }
+
+ public SwitchCellPage ()
+ {
+ var listview = new ListView {
+ HasUnevenRows = true,
+ };
+ var items = Enumerable.Range (0, 10);
+ listview.ItemsSource = items;
+ listview.ItemTemplate = new DataTemplate (typeof (MySwitchCell));
+ Content = listview;
+ Title = "Switch Cell";
+ }
+ }
+
+ public CellForceUpdateSizeGalleryPage ()
+ {
+ Children.Add (new ViewCellPage ());
+ Children.Add (new ImageCellPage ());
+ Children.Add (new TextCellPage ());
+ Children.Add (new EntryCellPage ());
+ Children.Add (new SwitchCellPage ());
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml b/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml
new file mode 100644
index 0000000..da51089
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Controls.LayoutAddPerformance">
+ <ScrollView>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Label x:Name="timingLabel" BackgroundColor="Gray" />
+ <StackLayout Grid.Row="1" x:Name="layout">
+ </StackLayout>
+ </Grid>
+ </ScrollView>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml.cs b/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml.cs
new file mode 100644
index 0000000..1c25c63
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ public partial class LayoutAddPerformance : ContentPage
+ {
+ public LayoutAddPerformance ()
+ {
+ InitializeComponent ();
+ }
+
+ protected override async void OnAppearing ()
+ {
+ base.OnAppearing ();
+
+ layout.Children.Clear ();
+
+ await Task.Delay (2000);
+
+ Stopwatch sw = new Stopwatch();
+ sw.Start ();
+ for (int i = 0; i < 500; i++) {
+ layout.Children.Add (new Label { Text = i.ToString () });
+ }
+ sw.Stop ();
+ this.timingLabel.Text = sw.ElapsedMilliseconds.ToString ();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/ListRefresh.cs b/Xamarin.Forms.Controls/ControlGalleryPages/ListRefresh.cs
new file mode 100644
index 0000000..28afd7b
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/ListRefresh.cs
@@ -0,0 +1,115 @@
+using System;
+using Xamarin.Forms;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ListRefresh : ContentPage
+ {
+ public ListRefresh ()
+ {
+ var refreshingCount = 0;
+
+ var grid = new Grid ();
+ var fooViewModel = new FooViewModel ();
+ var lv = new ListView {BindingContext = fooViewModel, IsGroupingEnabled = true, GroupDisplayBinding = new Binding ("Name"), IsPullToRefreshEnabled = false};
+
+ var stack = new StackLayout ();
+ var btn = new Button { Text = string.Format ("IsRefreshing {0}", lv.IsRefreshing) };
+ btn.Command = new Command (s => {
+ lv.IsRefreshing = !lv.IsRefreshing;
+ btn.Text = string.Format("IsRefreshing {0}",lv.IsRefreshing);
+ });
+
+ var btn4 = new Button { Text = "BeginRefresh", Command = new Command (s => {
+ lv.BeginRefresh();
+ btn.Text = string.Format("IsRefreshing {0}",lv.IsRefreshing);
+ }) };
+ var btn1 = new Button { Text = "EndRefresh", Command = new Command (s => {
+ lv.EndRefresh();
+ btn.Text = string.Format("IsRefreshing {0}",lv.IsRefreshing);
+ }) };
+
+ var btn2 = new Button { Text = string.Format ("Pull {0}", lv.IsPullToRefreshEnabled) };
+ btn2.Command = new Command (s => {
+ lv.IsPullToRefreshEnabled = !lv.IsPullToRefreshEnabled;
+ btn2.Text = string.Format("Pull {0}",lv.IsPullToRefreshEnabled);
+ });
+
+ var btn3 = new Button { Text = string.Format("CanExecute {0}",fooViewModel.CanExecute) };
+ btn3.Command = new Command (s => {
+ fooViewModel.CanExecute = !fooViewModel.CanExecute;
+ btn3.Text = string.Format("CanExecute {0}",fooViewModel.CanExecute);
+ });
+
+ var lbl = new Label { Text = string.Format ("Refreshing {0}", refreshingCount) };
+ lv.Refreshing += (object sender, EventArgs e) => {
+ refreshingCount++;
+ lbl.Text = string.Format ("Refreshing {0}", refreshingCount);
+ };
+
+ stack.Children.Add (btn);
+ stack.Children.Add (btn4);
+ stack.Children.Add (btn1);
+ stack.Children.Add (btn2);
+ stack.Children.Add (btn3);
+ stack.Children.Add (lbl);
+ lv.Header = new ContentView { HeightRequest = 300, HorizontalOptions = LayoutOptions.FillAndExpand, Content = stack };
+
+ lv.SetBinding<FooViewModel> (ListView.ItemsSourceProperty, m => m.Things);
+ lv.SetBinding<FooViewModel> (ListView.RefreshCommandProperty, m => m.RefreshThingsCommand);
+ grid.Children.Add (lv, 0, 0);
+
+ Content = grid;
+ }
+
+ public class FooViewModel
+ {
+ List<Group<string>> _things;
+ public List<Group<string>> Things {
+ get
+ {
+ return _things ?? (_things = new List<Group<string>> {
+ new Group<string>(new []{"A","B","C","D","E","F","G","H","I","J","K"}) {Name = "Letters"},
+ new Group<string>(new []{"1","2","3","4","5","6","7","8","9","10"}) {Name = "Numbers"}
+ });
+ }
+ }
+
+ bool _canExecute;
+ public bool CanExecute {
+ get
+ {
+ return _canExecute;
+ }
+ set {
+ _canExecute = value;
+ RefreshThingsCommand.ChangeCanExecute ();
+ }
+ }
+
+ Command _refreshThingsCommand;
+ public Command RefreshThingsCommand {
+ get {return _refreshThingsCommand ?? (_refreshThingsCommand = new Command (BeginRefreshThings, () => _canExecute ));}
+ }
+
+ protected void BeginRefreshThings()
+ {
+
+ }
+ }
+
+ public class Group<T> : ObservableCollection<T>
+ {
+ public Group (IEnumerable<T> seed) : base(seed){}
+
+ public string Name {
+ get;
+ set;
+ }
+ }
+ }
+}
+
+
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/ListScrollTo.cs b/Xamarin.Forms.Controls/ControlGalleryPages/ListScrollTo.cs
new file mode 100644
index 0000000..9e0d8a6
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/ListScrollTo.cs
@@ -0,0 +1,93 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class RandomSizeCell
+ : TextCell
+ {
+ static readonly Random Rand = new Random (42);
+
+ public RandomSizeCell()
+ {
+ SetBinding (TextProperty, new Binding ("."));
+ Height = Rand.Next (25, 60);
+ }
+ }
+
+ public class ListScrollTo
+ : ContentPage
+ {
+ readonly List<List<string>> _items = new List<List<string>> ();
+ bool _animate = true;
+ readonly ListView _listView;
+
+ public ListScrollTo()
+ {
+ Title = "ListView ScrollTo";
+
+ for (int i = 0; i < 10; i++) {
+ List<string> subItems = new List<string> ();
+ for (int x = 0; x < 10; x++) {
+ subItems.Add (((i * 10) + x + 1).ToString());
+ }
+
+ _items.Add (subItems);
+ }
+
+ _listView = new ListView {
+ Header = "Fooooo",
+ Footer = "Baaaaar",
+ ItemsSource = _items,
+ IsGroupingEnabled = true,
+ GroupDisplayBinding = new Binding ("[0]"),
+ GroupShortNameBinding = new Binding("[0]"),
+ HasUnevenRows = true,
+ ItemTemplate = new DataTemplate (typeof(RandomSizeCell))
+ };
+
+ _listView.ScrollTo (_items[2][1], _items[2], ScrollToPosition.Center, true);
+
+ var visible = new Button { Text = "Visible" };
+ visible.Clicked += (sender, args) => _listView.ScrollTo (_items[4][4], _items[4], ScrollToPosition.MakeVisible, _animate);
+
+ var start = new Button { Text = "Start" };
+ start.Clicked += (sender, args) => _listView.ScrollTo (_items[4][4], _items[4], ScrollToPosition.Start, _animate);
+
+ var center = new Button { Text = "Center"};
+ center.Clicked += (sender, args) => _listView.ScrollTo (_items[4][4], _items[4], ScrollToPosition.Center, _animate);
+
+ var end = new Button { Text = "End" };
+ end.Clicked += (sender, args) => _listView.ScrollTo (_items[4][4], _items[4], ScrollToPosition.End, _animate);
+
+ var animate = new Button { Text = "Animate" };
+ animate.Clicked += (sender, args) => {
+ _animate = !_animate;
+ animate.Text = (_animate) ? "Animate" : "No Animate";
+ };
+
+ var buttons = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Spacing = 1,
+ HorizontalOptions = LayoutOptions.Center,
+ Children = {
+ visible,
+ start,
+ center,
+ end,
+ animate
+ }
+ };
+
+ Content = new StackLayout {
+ Children = {
+ buttons,
+ _listView
+ }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/ListViewSelectionColor.cs b/Xamarin.Forms.Controls/ControlGalleryPages/ListViewSelectionColor.cs
new file mode 100644
index 0000000..66a8ad8
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/ListViewSelectionColor.cs
@@ -0,0 +1,150 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ internal sealed class ListViewSelectionColor : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ internal sealed class GroupHeaderTemplate : ViewCell
+ {
+ public GroupHeaderTemplate ()
+ {
+ var label = new Label { BackgroundColor = Color.Red };
+ label.SetBinding (Label.TextProperty, "Key");
+ View = label;
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal sealed class GroupItemTemplate : ViewCell
+ {
+ public GroupItemTemplate ()
+ {
+ var label = new Label { BackgroundColor = Color.Green };
+ label.SetBinding (Label.TextProperty, "Name");
+ View = label;
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal sealed class ItemTemplate : ViewCell
+ {
+ public ItemTemplate ()
+ {
+ var label = new Label { BackgroundColor = Color.Green };
+ label.SetBinding (Label.TextProperty, "Name");
+ View = label;
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal sealed class Artist
+ {
+ public string Name { get; private set; }
+
+ public Artist (string name)
+ {
+ Name = name;
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal sealed class Grouping<K, T> : ObservableCollection<T>
+ {
+ public K Key { get; private set; }
+
+ public Grouping (K key, IEnumerable<T> values)
+ {
+ Key = key;
+
+ foreach (T value in values) {
+ Items.Add (value);
+ }
+ }
+ }
+
+ Button _swapListButton;
+
+ [Preserve (AllMembers = true)]
+ public ListViewSelectionColor()
+ {
+ Title = "ListView ScrollTo";
+
+ var itemSource = new [] {
+ new { Name = "John Hassel" },
+ new { Name = "Brian Eno" },
+ new { Name = "Rober Fripp" },
+ new { Name = "Edgar Froese" }
+ };
+
+ var groupedItemSource = new List<Grouping<string, Artist>> {
+ new Grouping<string, Artist> ("Prog", new List<Artist> { new Artist ("King Crimson"), new Artist ("Yes"), new Artist ("Rush") }),
+ new Grouping<string, Artist> ("Techno", new List<Artist> { new Artist ("Juan Atkins"), new Artist ("Jeff Mills"), new Artist ("Gerald Donald") } ),
+ new Grouping<string, Artist> ("Pop", new List<Artist> { new Artist ("Japan"), new Artist ("Roxy Music"), new Artist ("Talking Heads") }),
+ };
+
+ var normalList = new ListView {
+ ItemTemplate = new DataTemplate (typeof (ItemTemplate)),
+ ItemsSource = itemSource
+ };
+ var groupedList = new ListView {
+ IsGroupingEnabled = true,
+ GroupHeaderTemplate = new DataTemplate (typeof (GroupHeaderTemplate)),
+ ItemTemplate = new DataTemplate (typeof (GroupItemTemplate)),
+ ItemsSource = groupedItemSource
+ };
+
+ var currentList = normalList;
+ _swapListButton = new Button {
+ Text = "Swap List Type",
+ Command = new Command (() => {
+ if (currentList == normalList) {
+ SetContent (groupedList);
+ currentList = groupedList;
+ } else {
+ SetContent (normalList);
+ currentList = normalList;
+ }
+ })
+ };
+
+ var clear = new Button {
+ Text = "Clear",
+ Command = new Command (() => {
+ currentList.SelectedItem = null;
+ })
+ };
+
+ Content = new StackLayout {
+ Children = {
+ new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ _swapListButton,
+ clear
+ }
+ },
+ normalList
+ }
+ };
+
+ }
+
+ void SetContent (ListView list)
+ {
+ Content = new StackLayout {
+ Children = {
+ _swapListButton,
+ list
+ }
+ };
+ }
+
+
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NavBarTitleTestPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NavBarTitleTestPage.cs
new file mode 100644
index 0000000..d6031cb
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/NavBarTitleTestPage.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class NavBarTitleTestPage : ContentPage
+ {
+
+ public NavBarTitleTestPage ()
+ {
+ var navTab = new NavigationPage { Title = "Hello 1 nav"};
+ navTab.PushAsync (GetPage (navTab));
+
+ var stackPages = new StackLayout ();
+
+ var btn3 = new Button {
+ Text = "tab", Command = new Command (async () => {
+ var tabbed = new TabbedPage { Title = "Main Tab" };
+ tabbed.Children.Add (navTab);
+ tabbed.Children.Add (GetPage (navTab));
+ await Navigation.PushModalAsync (tabbed);
+ })
+ };
+
+ var btn4 = new Button {
+ Text = "mdp", Command = new Command (async () => {
+ var newNav = new NavigationPage { Title = "Hello 1 nav", BarBackgroundColor = Color.Pink, BarTextColor = Color.Blue };
+ var mdp = new MasterDetailPage ();
+ await newNav.PushAsync (GetPage (newNav));
+ mdp.Master = new ContentPage {
+ Title = "Master", BackgroundColor = Color.Red, Content = new Button {
+ Text = "new", Command = new Command (() => {
+ mdp.Detail = new ContactsPage { Title = "hello 3" };
+ mdp.IsPresented = false;
+ })
+ }
+ };
+ mdp.Detail = newNav;
+ await Navigation.PushModalAsync (mdp);
+ })
+ };
+
+ var btn5 = new Button {
+ Text = "nav", Command = new Command (async () => {
+ var newNav = new NavigationPage { Title = "Hello 1 nav" };
+ await newNav.PushAsync (GetPage (newNav));
+ await Navigation.PushModalAsync (newNav);
+ })
+ };
+
+ var btn6 = new Button {
+ Text = "change nav", Command = new Command (() => {
+ (Parent as NavigationPage).BarBackgroundColor = Color.Blue;
+ (Parent as NavigationPage).BarTextColor = Color.Pink;
+ })
+ };
+
+ stackPages.Children.Add (btn3);
+ stackPages.Children.Add (btn4);
+ stackPages.Children.Add (btn5);
+ stackPages.Children.Add (btn6);
+ Content = stackPages;
+ }
+
+ static Page GetPage (NavigationPage navTab)
+ {
+ var stack = new StackLayout ();
+ var newPage = new ContentPage { Title = "Hello 2", Content = stack };
+ var btn1 = new Button { Text = "next", Command = new Command (async () => await newPage.Navigation.PushAsync (new ContactsPage { Title = "hello 3" })) };
+ var btn2 = new Button {
+ Text = "change nav", Command = new Command (() => {
+ navTab.BarBackgroundColor = Color.Blue;
+ navTab.BarTextColor = Color.Pink;
+ })
+ };
+ var btn3 = new Button {
+ Text = "pop modal", Command = new Command (() => {
+ newPage.Navigation.PopModalAsync ();
+ })
+ };
+ stack.Children.Add (btn1);
+ stack.Children.Add (btn2);
+ stack.Children.Add (btn3);
+ return newPage;
+
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs
new file mode 100644
index 0000000..9f59660
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/NestedNativeControlGalleryPage.cs
@@ -0,0 +1,27 @@
+namespace Xamarin.Forms.Controls
+{
+ public partial class NestedNativeControlGalleryPage : ContentPage
+ {
+ public StackLayout Layout { get; set; }
+
+ public bool NativeControlsAdded { get; set; }
+
+ public NestedNativeControlGalleryPage ()
+ {
+ Layout = new StackLayout { Padding = 20, VerticalOptions = LayoutOptions.FillAndExpand };
+
+ Content = new ScrollView { Content = Layout };
+
+ var label = new Label { Text = "There should be some native controls right below this", FontSize = 12 };
+
+ var testLabel = new Label { Text = "Forms Label", FontSize = 14 };
+ var button = new Button { Text = "Resize Forms Label", HeightRequest = 80 };
+ double originalSize = testLabel.FontSize;
+ button.Clicked += (sender, args) => { testLabel.FontSize = testLabel.FontSize == originalSize ? 24 : 14; };
+
+ Layout.Children.Add(testLabel);
+ Layout.Children.Add(button);
+ Layout.Children.Add(label);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/PanGestureGalleryPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/PanGestureGalleryPage.cs
new file mode 100644
index 0000000..b37e8e4
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/PanGestureGalleryPage.cs
@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class PanGestureGalleryPage : ContentPage
+ {
+ public class PanContainer : ContentView
+ {
+ public PanContainer ()
+ {
+ var pan = new PanGestureRecognizer
+ {
+ TouchPoints = 1
+ };
+
+ pan.PanUpdated += (object s, PanUpdatedEventArgs e) =>
+ {
+ switch (e.StatusType) {
+
+ case GestureStatus.Started: break;
+
+ case GestureStatus.Running:
+ Content.TranslationX = e.TotalX;
+ Content.TranslationY = e.TotalY;
+ break;
+
+ default:
+ Content.TranslationX = Content.TranslationY = 0;
+ break;
+ }
+ };
+
+ var pinch = new PinchGestureRecognizer ();
+
+ double xOffset = 0;
+ double yOffset = 0;
+ double startScale = 1;
+
+ pinch.PinchUpdated += (sender, e) =>
+ {
+
+ if (e.Status == GestureStatus.Started) {
+ startScale = Content.Scale;
+ Content.AnchorX = Content.AnchorY = 0;
+ }
+ if (e.Status == GestureStatus.Running) {
+
+ _currentScale += (e.Scale - 1) * startScale;
+ _currentScale = Math.Max (1, _currentScale);
+
+ var renderedX = Content.X + xOffset;
+ var deltaX = renderedX / Width;
+ var deltaWidth = Width / (Content.Width * startScale);
+ var originX = (e.ScaleOrigin.X - deltaX) * deltaWidth;
+
+ var renderedY = Content.Y + yOffset;
+ var deltaY = renderedY / Height;
+ var deltaHeight = Height / (Content.Height * startScale);
+ var originY = (e.ScaleOrigin.Y - deltaY) * deltaHeight;
+
+ double targetX = xOffset - (originX * Content.Width) * (_currentScale - startScale);
+ double targetY = yOffset - (originY * Content.Height) * (_currentScale - startScale);
+
+ Content.TranslationX = targetX.Clamp (-Content.Width * (_currentScale - 1), 0);
+ Content.TranslationY = targetY.Clamp (-Content.Height * (_currentScale - 1), 0);
+
+ Content.Scale = _currentScale;
+ }
+ if (e.Status == GestureStatus.Completed) {
+ xOffset = Content.TranslationX;
+ yOffset = Content.TranslationY;
+ }
+ };
+
+ GestureRecognizers.Add (pinch);
+
+ GestureRecognizers.Add (pan);
+ }
+
+ double _currentScale = 1;
+ }
+
+ public PanGestureGalleryPage ()
+ {
+ var image = new Image { Source = "http://placehold.it/2000x2000", BackgroundColor = Color.Gray, WidthRequest = 2000, HeightRequest = 2000, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center };
+
+ var panme = new PanContainer { Content = image };
+
+ Content = new StackLayout { Children = { new Label { Text = "Use two fingers to pinch. Use one finger to pan." }, panme }, Padding = new Thickness (20) };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/PinchGestureTestPage.cs b/Xamarin.Forms.Controls/ControlGalleryPages/PinchGestureTestPage.cs
new file mode 100644
index 0000000..44dd6ae
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/PinchGestureTestPage.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Diagnostics;
+
+namespace Xamarin.Forms.Controls
+{
+ public class PinchToZoomContainer : ContentView
+ {
+ public PinchToZoomContainer ()
+ {
+
+ }
+
+ public void AddPinch ()
+ {
+
+ var pinch = new PinchGestureRecognizer ();
+
+ double xOffset = 0;
+ double yOffset = 0;
+ double startScale = 1;
+
+ pinch.PinchUpdated += (sender, e) => {
+
+ if (e.Status == GestureStatus.Started) {
+ startScale = Content.Scale;
+ Content.AnchorX = Content.AnchorY = 0;
+ }
+ if (e.Status == GestureStatus.Running) {
+
+ _currentScale += (e.Scale - 1) * startScale;
+ _currentScale = Math.Max (1, _currentScale);
+
+ var renderedX = Content.X + xOffset;
+ var deltaX = renderedX / Width;
+ var deltaWidth = Width / (Content.Width * startScale);
+ var originX = (e.ScaleOrigin.X - deltaX) * deltaWidth;
+
+ var renderedY = Content.Y + yOffset;
+ var deltaY = renderedY / Height;
+ var deltaHeight = Height / (Content.Height * startScale);
+ var originY = (e.ScaleOrigin.Y - deltaY) * deltaHeight;
+
+ double targetX = xOffset - (originX * Content.Width) * (_currentScale - startScale);
+ double targetY = yOffset - (originY * Content.Height) * (_currentScale - startScale);
+
+ Content.TranslationX = targetX.Clamp (-Content.Width * (_currentScale - 1), 0);
+ Content.TranslationY = targetY.Clamp (-Content.Height * (_currentScale - 1), 0);
+
+ Content.Scale = _currentScale;
+ }
+ if (e.Status == GestureStatus.Completed) {
+ xOffset = Content.TranslationX;
+ yOffset = Content.TranslationY;
+ }
+ };
+
+ GestureRecognizers.Add (pinch);
+ }
+
+ public bool AlwaysZoomCenter { get; set; }
+
+ double _currentScale = 1;
+ }
+
+ public class PinchGestureTestPage : ContentPage
+ {
+ public PinchGestureTestPage ()
+ {
+ var stack = new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center };
+ var textBoxScale = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center };
+ var textBox = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center };
+ var textBoxPoint = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Center };
+ stack.Children.Add (textBox);
+ stack.Children.Add (textBoxScale);
+ stack.Children.Add (textBoxPoint);
+
+ var box = new Image { Source = "crimson.jpg", BackgroundColor = Color.Red, WidthRequest = 200, HeightRequest = 200, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center };
+
+ var zoomContainer = new PinchToZoomContainer ();
+ zoomContainer.Content = box;
+
+ var btn = new Button { Text = "add pinch gesture", Command = new Command (() => zoomContainer.AddPinch ()) };
+ var btnRemove = new Button { Text = "remove pinch gesture", Command = new Command (() => zoomContainer.GestureRecognizers.Clear ()) };
+
+ Content = new StackLayout { Children = { btn, btnRemove, new Grid { Children = { zoomContainer }, Padding = new Thickness (20) } } };
+ }
+
+ double _currentScale = 1;
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs b/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs
new file mode 100644
index 0000000..3e98fc8
--- /dev/null
+++ b/Xamarin.Forms.Controls/ControlGalleryPages/ToolbarItems.cs
@@ -0,0 +1,55 @@
+using System;
+
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ToolbarItems : ContentPage
+ {
+ bool _isEnable = false;
+ public ToolbarItems ()
+ {
+ var label = new Label { Text = "Hello ContentPage", AutomationId ="label_id" };
+
+ var tb1 = new ToolbarItem ("tb1", "menuIcon.png", () => {
+ label.Text = "tb1";
+ }, ToolbarItemOrder.Primary);
+ tb1.IsEnabled = _isEnable;
+ tb1.AutomationId = "toolbaritem_primary";
+ tb1.IsEnabled = _isEnable;
+
+ var tb2 = new ToolbarItem ("tb2", null, () => {
+ label.Text = "tb2";
+ }, ToolbarItemOrder.Primary);
+ tb2.AutomationId = "toolbaritem_primary2";
+
+ var tb3 = new ToolbarItem ("tb3", "bank.png", () => {
+ label.Text = "tb3";
+ }, ToolbarItemOrder.Secondary);
+ tb3.AutomationId = "toolbaritem_secondary";
+
+ var tb4 = new ToolbarItem ();
+ tb4.Text = "tb4";
+ tb4.Order = ToolbarItemOrder.Secondary;
+ tb4.Command = new Command( (obj)=> {
+ _isEnable = true;
+ label.Text = "tb4";
+ (tb4.Command as Command).ChangeCanExecute();
+ },(obj) => _isEnable);
+ tb4.AutomationId = "toolbaritem_secondary2";
+
+ ToolbarItems.Add(tb1);
+ ToolbarItems.Add(tb2);
+ ToolbarItems.Add(tb3);
+ ToolbarItems.Add(tb4);
+
+ Content = new StackLayout {
+ Children = {
+ label
+ }
+ };
+ }
+ }
+}
+
+
diff --git a/Xamarin.Forms.Controls/Controls/Issue3076Button.cs b/Xamarin.Forms.Controls/Controls/Issue3076Button.cs
new file mode 100644
index 0000000..0ab43bc
--- /dev/null
+++ b/Xamarin.Forms.Controls/Controls/Issue3076Button.cs
@@ -0,0 +1,14 @@
+namespace Xamarin.Forms.Controls
+{
+ public class Issue3076Button : Button
+ {
+ public static readonly BindableProperty HorizontalContentAlignmentProperty =
+ BindableProperty.Create ("HorizontalContentAlignemnt", typeof(TextAlignment), typeof(Issue3076Button), TextAlignment.Center);
+
+ public TextAlignment HorizontalContentAlignment
+ {
+ get { return (TextAlignment)GetValue (HorizontalContentAlignmentProperty); }
+ set { SetValue (HorizontalContentAlignmentProperty, value); }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGallery.cs b/Xamarin.Forms.Controls/CoreGallery.cs
new file mode 100644
index 0000000..21c45e0
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGallery.cs
@@ -0,0 +1,419 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Dynamic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Xamarin.Forms.Controls.GalleryPages;
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ public static class Messages
+ {
+ public const string ChangeRoot = "com.xamarin.ChangeRoot";
+ }
+
+ internal class CoreCarouselPage : CarouselPage
+ {
+ public CoreCarouselPage ()
+ {
+ AutomationId = "CarouselPageRoot";
+ Children.Add (new CoreRootPage (this, NavigationBehavior.PushModalAsync) { Title = "Page 1" });
+ Children.Add (new CoreRootPage (this, NavigationBehavior.PushModalAsync) { Title = "Page 2" });
+ }
+ }
+
+ internal class CoreContentPage : ContentPage
+ {
+ public CoreContentPage ()
+ {
+ AutomationId = "ContentPageRoot";
+ Content = new StackLayout { Children = { new CoreRootView (), new CorePageView (this, NavigationBehavior.PushModalAsync) } };
+ }
+ }
+
+ internal class CoreMasterDetailPage : MasterDetailPage
+ {
+ public CoreMasterDetailPage ()
+ {
+ AutomationId = "MasterDetailPageRoot";
+
+ var toCrashButton = new Button {Text = "Crash Me"};
+
+ var masterPage = new ContentPage {Title = "Menu", Icon = "bank.png", Content = toCrashButton};
+ var detailPage = new CoreRootPage (this, NavigationBehavior.PushModalAsync) { Title = "DetailPage" };
+
+ bool toggle = false;
+ toCrashButton.Clicked += (sender, args) => {
+ if (toggle)
+ Detail = new ContentPage { BackgroundColor = Color.Green, };
+ else
+ Detail = detailPage;
+
+ toggle = !toggle;
+ };
+
+ Master = masterPage;
+ Detail = detailPage;
+ }
+ }
+
+ internal class CoreNavigationPage : NavigationPage
+ {
+ public CoreNavigationPage ()
+ {
+ AutomationId = "NavigationPageRoot";
+ Navigation.PushAsync (new CoreRootPage (this));
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Github, 2456, "StackOverflow after reordering tabs in a TabbedPageView", PlatformAffected.All)]
+ public class CoreTabbedPage : TestTabbedPage
+ {
+ protected override void Init ()
+ {
+
+ }
+#if APP
+ public CoreTabbedPage ()
+ {
+ AutomationId = "TabbedPageRoot";
+ Children.Add (new CoreRootPage (this, NavigationBehavior.PushModalAsync) { Title = "Tab 1" });
+ Children.Add (new CoreRootPage (this, NavigationBehavior.PushModalAsync) { Title = "Tab 2" });
+ Children.Add(new NavigationPage(new Page())
+ {
+ Title = "Rubriques",
+ });
+
+ Children.Add(new NavigationPage(new Page())
+ {
+ Title = "Le Club",
+ });
+
+ Children.Add(new NavigationPage(new Page{Title = "Bookmarks"})
+ {
+ Title = "Bookmarks",
+ });
+
+ Children.Add(new NavigationPage(new Page() { Title = "Alertes" })
+ {
+ Title = "Notifications",
+ });
+
+ Children.Add(new NavigationPage (new Page(){Title = "My account"})
+ {
+ Title = "My account",
+ });
+
+ Children.Add(new NavigationPage(new Page(){Title = "About"})
+ {
+ Title = "About",
+ });
+ }
+#endif
+
+#if UITest
+ [Test]
+ [Issue (IssueTracker.Github, 2456, "StackOverflow after reordering tabs in a TabbedPageView", PlatformAffected.iOS)]
+ public void TestReorderTabs ()
+ {
+ App.Tap (c => c.Marked("More"));
+ App.Tap (c => c.Marked("Edit"));
+ var bookmarks = App.Query (c => c.Marked ("Bookmarks"))[0];
+ var notifications = App.Query (c => c.Marked ("Notifications"))[0];
+ var tab2 = App.Query (c => c.Marked ("Tab 2"))[2];
+ var rubriques = App.Query (c => c.Marked ("Rubriques"))[2];
+ App.DragCoordinates (bookmarks.Rect.CenterX, bookmarks.Rect.CenterY, rubriques.Rect.CenterX, rubriques.Rect.CenterY);
+ App.DragCoordinates (notifications.Rect.CenterX, notifications.Rect.CenterY, tab2.Rect.CenterX, tab2.Rect.CenterY);
+ App.Tap (c => c.Marked("Done"));
+ App.Tap (c => c.Marked("Tab 1"));
+ App.Tap (c => c.Marked("Le Club"));
+ App.Tap (c => c.Marked("Bookmarks"));
+ App.Tap (c => c.Marked("Notifications"));
+ }
+#endif
+ }
+
+ [Preserve (AllMembers = true)]
+ internal class CoreViewContainer
+ {
+ public string Name { get; private set; }
+ public Type PageType { get; private set; }
+
+ public CoreViewContainer (string name, Type pageType)
+ {
+ Name = name;
+ PageType = pageType;
+ }
+ }
+
+ public class CoreRootView : ListView
+ {
+ public CoreRootView ()
+ {
+ var roots = new [] {
+ new CoreViewContainer ("SwapRoot - CarouselPage", typeof(CoreCarouselPage)),
+ new CoreViewContainer ("SwapRoot - ContentPage", typeof(CoreContentPage)),
+ new CoreViewContainer ("SwapRoot - MasterDetailPage", typeof(CoreMasterDetailPage)),
+ new CoreViewContainer ("SwapRoot - NavigationPage", typeof(CoreNavigationPage)),
+ new CoreViewContainer ("SwapRoot - TabbedPage", typeof(CoreTabbedPage)),
+ };
+
+ var template = new DataTemplate (typeof(TextCell));
+ template.SetBinding (TextCell.TextProperty, "Name");
+
+ ItemTemplate = template;
+ ItemsSource = roots;
+
+#if PRE_APPLICATION_CLASS
+ ItemSelected += (sender, args) => MessagingCenter.Send (this, Messages.ChangeRoot, ((CoreViewContainer)args.SelectedItem).PageType);
+#else
+ ItemSelected += (sender, args) => {
+ var app = Application.Current as App;
+ if (app != null) {
+ var page = (Page)Activator.CreateInstance (((CoreViewContainer)args.SelectedItem).PageType);
+ app.SetMainPage (page);
+ }
+ };
+#endif
+ }
+ }
+
+ internal class CorePageView : ListView
+ {
+ public CorePageView (Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync)
+ {
+ var pages = new List<Page> {
+ new CarouselViewGallaryPage {Title = "CarouselView Gallery"},
+ new NestedNativeControlGalleryPage {Title = "Nested Native Controls Gallery"},
+ new CellForceUpdateSizeGalleryPage {Title = "Cell Force Update Size Gallery"},
+ new AppearingGalleryPage {Title = "Appearing Gallery"},
+ new EntryCoreGalleryPage { Title = "Entry Gallery" },
+ new NavBarTitleTestPage {Title = "Titles And Navbar Windows"},
+ new PanGestureGalleryPage {Title = "Pan gesture Gallery"},
+ new PinchGestureTestPage {Title = "Pinch gesture Gallery"},
+ new AutomationIdGallery { Title ="AutomationID Gallery" },
+ new LayoutPerformanceGallery {Title = "Layout Perf Gallery"},
+ new ListViewSelectionColor { Title = "ListView SelectionColor Gallery" },
+ new AlertGallery { Title = "DisplayAlert Gallery" },
+ new ToolbarItems { Title = "ToolbarItems Gallery" },
+ new ActionSheetGallery { Title = "ActionSheet Gallery" },
+ new ActivityIndicatorCoreGalleryPage { Title = "ActivityIndicator Gallery" },
+ new BehaviorsAndTriggers { Title = "BehaviorsTriggers Gallery" },
+ new ContextActionsGallery { Title = "ContextActions List Gallery"},
+ new ContextActionsGallery (tableView: true) { Title = "ContextActions Table Gallery"},
+ new CoreBoxViewGalleryPage { Title = "BoxView Gallery" },
+ new ButtonCoreGalleryPage { Title = "Button Gallery" },
+ new DatePickerCoreGalleryPage { Title = "DatePicker Gallery" },
+ new EditorCoreGalleryPage { Title = "Editor Gallery" },
+ new FrameCoreGalleryPage { Title = "Frame Gallery" },
+ new ImageCoreGalleryPage { Title = "Image Gallery" },
+ new KeyboardCoreGallery { Title = "Keyboard Gallery" },
+ new LabelCoreGalleryPage { Title = "Label Gallery" },
+ new ListViewCoreGalleryPage { Title = "ListView Gallery" },
+ new OpenGLViewCoreGalleryPage { Title = "OpenGLView Gallery" },
+ new PickerCoreGalleryPage { Title = "Picker Gallery" },
+ new ProgressBarCoreGalleryPage { Title = "ProgressBar Gallery" },
+ new ScrollGallery { Title = "ScrollView Gallery" },
+ new ScrollGallery(ScrollOrientation.Horizontal) { Title = "ScrollView Gallery Horizontal" },
+ new ScrollGallery(ScrollOrientation.Both) { Title = "ScrollView Gallery 2D" },
+ new SearchBarCoreGalleryPage { Title = "SearchBar Gallery" },
+ new SliderCoreGalleryPage { Title = "Slider Gallery" },
+ new StepperCoreGalleryPage { Title = "Stepper Gallery" },
+ new SwitchCoreGalleryPage { Title = "Switch Gallery" },
+ new TableViewCoreGalleryPage { Title = "TableView Gallery" },
+ new TimePickerCoreGalleryPage { Title = "TimePicker Gallery" },
+ new WebViewCoreGalleryPage { Title = "WebView Gallery" },
+ //pages
+ new RootContentPage ("Content") { Title = "RootPages Gallery" },
+ new MasterDetailPageTabletPage { Title = "MasterDetailPage Tablet Page" },
+ // legacy galleries
+ new AbsoluteLayoutGallery { Title = "AbsoluteLayout Gallery - Legacy" },
+ new BoundContentPage { Title = "BoundPage Gallery - Legacy" },
+ new BackgroundImageGallery { Title = "BackgroundImage gallery" },
+ new ButtonGallery { Title = "Button Gallery - Legacy" },
+ new CarouselPageGallery { Title = "CarouselPage Gallery - Legacy" },
+ new CellTypesListPage { Title = "Cells Gallery - Legacy" },
+ new ClipToBoundsGallery { Title = "ClipToBounds Gallery - Legacy" },
+ new ControlTemplatePage { Title = "ControlTemplated Gallery - Legacy" },
+ new ControlTemplateXamlPage { Title = "ControlTemplated XAML Gallery - Legacy" },
+ new DisposeGallery { Title = "Dispose Gallery - Legacy" },
+ new EditorGallery { Title = "Editor Gallery - Legacy" },
+ new EntryGallery { Title = "Entry Gallery - Legacy" },
+ new FrameGallery { Title = "Frame Gallery - Legacy" },
+ new GridGallery { Title = "Grid Gallery - Legacy" },
+ new GroupedListActionsGallery { Title = "GroupedListActions Gallery - Legacy" },
+ new GroupedListContactsGallery { Title = "GroupedList Gallery - Legacy" },
+ new ImageGallery { Title = "Image Gallery - Legacy" },
+ new ImageLoadingGallery { Title = "ImageLoading Gallery - Legacy" },
+ new InputIntentGallery { Title = "InputIntent Gallery - Legacy" },
+ new LabelGallery { Title = "Label Gallery - Legacy" },
+ new LayoutAddPerformance { Title = "Layout Add Performance - Legacy" },
+ new LayoutOptionsGallery { Title = "LayoutOptions Gallery - Legacy" },
+ new LineBreakModeGallery { Title = "LineBreakMode Gallery - Legacy" },
+ new ListPage { Title = "ListView Gallery - Legacy" },
+ new ListScrollTo { Title = "ListView.ScrollTo" },
+ new ListRefresh { Title = "ListView.PullToRefresh" },
+ new ListViewDemoPage { Title = "ListView Demo Gallery - Legacy" },
+ new MapGallery { Title = "Map Gallery - Legacy" },
+ new MinimumSizeGallery { Title = "MinimumSize Gallery - Legacy" },
+ new MultiGallery { Title = "Multi Gallery - Legacy" },
+ new NavigationMenuGallery { Title = "NavigationMenu Gallery - Legacy" },
+ new NavigationPropertiesGallery { Title = "Navigation Properties" },
+#if HAVE_OPENTK
+ new OpenGLGallery { Title = "OpenGLGallery - Legacy" },
+#endif
+ new PickerGallery {Title = "Picker Gallery - Legacy"},
+ new ProgressBarGallery { Title = "ProgressBar Gallery - Legacy" },
+ new RelativeLayoutGallery { Title = "RelativeLayout Gallery - Legacy" },
+ new ScaleRotate { Title = "Scale Rotate Gallery - Legacy" },
+ new SearchBarGallery { Title = "SearchBar Gallery - Legacy" },
+ new SettingsPage { Title = "Settings Page - Legacy" },
+ new SliderGallery { Title = "Slider Gallery - Legacy" },
+ new StackLayoutGallery { Title = "StackLayout Gallery - Legacy" },
+ new StepperGallery { Title = "Stepper Gallery - Legacy" },
+ new StyleGallery {Title = "Style Gallery"},
+ new StyleXamlGallery {Title = "Style Gallery in Xaml"},
+ new SwitchGallery { Title = "Switch Gallery - Legacy" },
+ new TableViewGallery { Title = "TableView Gallery - Legacy" },
+ new TemplatedCarouselGallery { Title = "TemplatedCarouselPage Gallery - Legacy" },
+ new TemplatedTabbedGallery { Title = "TemplatedTabbedPage Gallery - Legacy" },
+ new ToolbarGallery { Title = "Toolbar Gallery - Legacy" },
+ new UnevenViewCellGallery { Title = "UnevenViewCell Gallery - Legacy" },
+ new UnevenListGallery { Title = "UnevenList Gallery - Legacy" },
+ new ViewCellGallery { Title = "ViewCell Gallery - Legacy" },
+ new WebViewGallery {Title = "WebView Gallery - Legacy"},
+ };
+
+ titleToPage = pages.ToDictionary (o => o.Title);
+
+ // avoid NRE for root pages without NavigationBar
+ if (navigationBehavior == NavigationBehavior.PushAsync && rootPage.GetType () == typeof (CoreNavigationPage)) {
+ pages.Add (new NavigationBarGallery ((NavigationPage)rootPage) { Title = "NavigationBar Gallery - Legacy" });
+ }
+
+ var template = new DataTemplate (typeof(TextCell));
+ template.SetBinding (TextCell.TextProperty, "Title");
+
+ BindingContext = pages;
+ ItemTemplate = template;
+ ItemsSource = pages;
+
+ ItemSelected += async (sender, args) => {
+ if (SelectedItem == null)
+ return;
+
+ var item = args.SelectedItem;
+ var page = item as Page;
+ if (page != null)
+ await PushPage (page);
+
+ SelectedItem = null;
+ };
+ }
+
+ NavigationBehavior navigationBehavior;
+
+ async Task PushPage (Page contentPage)
+ {
+ if (Insights.IsInitialized) {
+ Insights.Track ("Navigation", new Dictionary<string, string> {
+ { "Pushing", contentPage.GetType().Name }
+ });
+ }
+
+ if (navigationBehavior == NavigationBehavior.PushModalAsync) {
+ await Navigation.PushModalAsync (contentPage);
+ } else {
+ await Navigation.PushAsync (contentPage);
+ }
+ }
+
+ Dictionary<string, Page> titleToPage = new Dictionary<string, Page>();
+ public async Task PushPage (string pageTitle)
+ {
+
+ Page page = null;
+ if (!titleToPage.TryGetValue (pageTitle, out page))
+ return;
+
+ if (Insights.IsInitialized) {
+ Insights.Track ("Navigation", new Dictionary<string, string> {
+ { "Pushing", page.GetType().Name }
+ });
+ }
+
+ await PushPage (page);
+ }
+ }
+
+ internal class CoreRootPage : ContentPage
+ {
+ public CoreRootPage (Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync)
+ {
+ IStringProvider stringProvider = DependencyService.Get<IStringProvider> ();
+
+ Title = stringProvider.CoreGalleryTitle;
+
+ var corePageView = new CorePageView (rootPage, navigationBehavior);
+
+ var searchBar = new SearchBar () {
+ AutomationId = "SearchBar"
+ };
+
+ var testCasesButton = new Button {
+ Text = "Go to Test Cases",
+ AutomationId = "GoToTestButton",
+ Command = new Command (async () => {
+ if (!string.IsNullOrEmpty (searchBar.Text))
+ await corePageView.PushPage (searchBar.Text);
+ else
+ await Navigation.PushModalAsync (TestCases.GetTestCases ());
+ })
+ };
+
+ var stackLayout = new StackLayout () {
+ Children = {
+ testCasesButton,
+ searchBar,
+ new Button {
+ Text = "Click to Force GC",
+ Command = new Command(() => {
+ GC.Collect ();
+ GC.WaitForPendingFinalizers ();
+ GC.Collect ();
+ })
+ }
+
+ }
+ };
+
+ Content = new AbsoluteLayout {
+ Children = {
+ { new CoreRootView (), new Rectangle(0, 0.0, 1, 0.35), AbsoluteLayoutFlags.All },
+ { stackLayout, new Rectangle(0, 0.5, 1, 0.30), AbsoluteLayoutFlags.All },
+ { corePageView, new Rectangle(0, 1.0, 1.0, 0.35), AbsoluteLayoutFlags.All },
+ }
+ };
+ }
+ }
+
+ public interface IStringProvider
+ {
+ string CoreGalleryTitle { get; }
+ }
+
+ public static class CoreGallery
+ {
+ public static Page GetMainPage ()
+ {
+ return new CoreNavigationPage ();
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs
new file mode 100644
index 0000000..8265cf7
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs
@@ -0,0 +1,39 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ActivityIndicatorCoreGalleryPage : CoreGalleryPage<ActivityIndicator>
+ {
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return true; }
+ }
+
+ protected override void InitializeElement (ActivityIndicator element)
+ {
+ element.IsRunning = true;
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var colorContainer = new ViewContainer<ActivityIndicator> (Test.ActivityIndicator.Color, new ActivityIndicator {
+ Color = Color.Lime,
+ IsRunning = true
+
+ });
+
+ var isRunningContainer = new StateViewContainer<ActivityIndicator> (Test.ActivityIndicator.IsRunning, new ActivityIndicator {
+ IsRunning = true
+ });
+
+ isRunningContainer.StateChangeButton.Clicked += (sender, args) => {
+ isRunningContainer.View.IsRunning = !isRunningContainer.View.IsRunning;
+ };
+
+ Add (colorContainer);
+ Add (isRunningContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ButtonCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ButtonCoreGalleryPage.cs
new file mode 100644
index 0000000..65aa6fa
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/ButtonCoreGalleryPage.cs
@@ -0,0 +1,106 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ButtonCoreGalleryPage : CoreGalleryPage<Button>
+ {
+ protected override bool SupportsTapGestureRecognizer {
+ get { return false; }
+ }
+
+ protected override bool SupportsFocus {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (Button element)
+ {
+ element.Text = "Button";
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ IsEnabledStateViewContainer.View.Clicked += (sender, args) => IsEnabledStateViewContainer.TitleLabel.Text += " (Tapped)";
+
+ var borderButtonContainer = new ViewContainer<Button> (Test.Button.BorderColor,
+ new Button {
+ Text = "BorderColor",
+ BackgroundColor = Color.Transparent,
+ BorderColor = Color.Red,
+ BorderWidth = 1,
+ }
+ );
+
+ var borderRadiusContainer = new ViewContainer<Button> (Test.Button.BorderRadius,
+ new Button {
+ Text = "BorderRadius",
+ BackgroundColor = Color.Transparent,
+ BorderColor = Color.Red,
+ BorderRadius = 20,
+ BorderWidth = 1,
+ }
+ );
+
+ var borderWidthContainer = new ViewContainer<Button> (Test.Button.BorderWidth,
+ new Button {
+ Text = "BorderWidth",
+ BackgroundColor = Color.Transparent,
+ BorderColor = Color.Red,
+ BorderWidth = 15,
+ }
+ );
+
+ var clickedContainer = new EventViewContainer<Button> (Test.Button.Clicked,
+ new Button {
+ Text = "Clicked"
+ }
+ );
+ clickedContainer.View.Clicked += (sender, args) => clickedContainer.EventFired ();
+
+ var commandContainer = new ViewContainer<Button> (Test.Button.Command,
+ new Button {
+ Text = "Command",
+ Command = new Command (() => DisplayActionSheet ("Hello Command", "Cancel", "Destroy"))
+ }
+ );
+
+ var fontContainer = new ViewContainer<Button> (Test.Button.Font,
+ new Button {
+ Text = "Font",
+ Font = Font.SystemFontOfSize (NamedSize.Large, FontAttributes.Bold)
+ }
+ );
+
+ var imageContainer = new ViewContainer<Button> (Test.Button.Image,
+ new Button {
+ Text = "Image",
+ Image = new FileImageSource { File = "bank.png" }
+ }
+ )
+ ;
+ var textContainer = new ViewContainer<Button> (Test.Button.Text,
+ new Button {
+ Text = "Text"
+ }
+ );
+
+ var textColorContainer = new ViewContainer<Button> (Test.Button.TextColor,
+ new Button {
+ Text = "TextColor", TextColor = Color.Pink
+ }
+ );
+
+ Add (borderButtonContainer);
+ Add (borderRadiusContainer);
+ Add (borderWidthContainer);
+ Add (clickedContainer);
+ Add (commandContainer);
+ Add (fontContainer);
+ Add (imageContainer);
+ Add (textContainer);
+ Add (textColorContainer);
+ //stackLayout.Children.Add (textColorContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/CoreBoxViewGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/CoreBoxViewGalleryPage.cs
new file mode 100644
index 0000000..57ceaf4
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/CoreBoxViewGalleryPage.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Threading;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class CoreBoxViewGalleryPage : CoreGalleryPage<BoxView>
+ {
+ static readonly object SyncLock = new object ();
+ static readonly Random Rand = new Random ();
+
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (BoxView element)
+ {
+ lock (SyncLock) {
+ var red = Rand.NextDouble ();
+ var green = Rand.NextDouble ();
+ var blue = Rand.NextDouble ();
+ element.Color = new Color (red, green, blue);
+ }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var colorContainer = new ViewContainer<BoxView> (Test.BoxView.Color, new BoxView { Color = Color.Pink });
+
+ Add (colorContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/CoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/CoreGalleryPage.cs
new file mode 100644
index 0000000..41b3a79
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/CoreGalleryPage.cs
@@ -0,0 +1,185 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Threading;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class CoreGalleryPage<T> : ContentPage
+ where T : View, new ()
+ {
+ List<View> _views;
+ int _currentIndex;
+ Picker _picker;
+ StackLayout _moveNextStack;
+
+ ViewContainer<T> _backgroundColorViewContainer;
+ ViewContainer<T> _opacityViewContainer;
+ ViewContainer<T> _rotationViewContainer;
+ ViewContainer<T> _rotationXViewContainer;
+ ViewContainer<T> _rotationYViewContainer;
+ ViewContainer<T> _scaleViewContainer;
+ ViewContainer<T> _translationXViewContainer;
+ ViewContainer<T> _translationYViewContainer;
+
+ StateViewContainer<T> _focusStateViewContainer;
+ StateViewContainer<T> _isFocusedStateViewContainer;
+ StateViewContainer<T> _isVisibleStateViewContainer;
+
+ EventViewContainer<T> _gestureRecognizerEventViewContainer;
+ EventViewContainer<T> _focusedEventViewContainer;
+ EventViewContainer<T> _unfocusedEventViewContainer;
+
+ LayeredViewContainer<T> _inputTransparentViewContainer;
+
+ protected StateViewContainer<T> IsEnabledStateViewContainer { get; private set; }
+
+ protected StackLayout Layout { get; private set; }
+
+ internal CoreGalleryPage ()
+ {
+ Layout = new StackLayout {
+ Padding = new Thickness (20)
+ };
+
+ var modalDismissButton = new Button () {
+ Text = "Dismiss Page",
+ Command = new Command (async () => await Navigation.PopModalAsync ())
+ };
+ Layout.Children.Add (modalDismissButton);
+
+ Build (Layout);
+
+ Content = new ScrollView { AutomationId = "GalleryScrollView", Content = Layout };
+
+ }
+
+ protected virtual void InitializeElement (T element) {}
+
+ protected virtual void Build (StackLayout stackLayout)
+ {
+ var isFocusedView = new T ();
+ isFocusedView.SetValueCore (IsFocusedPropertyKey, true);
+
+ var viewContainers = new[] {
+ _isFocusedStateViewContainer = new StateViewContainer<T> (Test.VisualElement.IsFocused, isFocusedView),
+ _backgroundColorViewContainer = new ViewContainer<T> (Test.VisualElement.BackgroundColor, new T { BackgroundColor = Color.Blue }),
+ _focusStateViewContainer = new StateViewContainer<T> (Test.VisualElement.Focus, new T ()),
+ _gestureRecognizerEventViewContainer = new EventViewContainer<T> (Test.View.GestureRecognizers, new T ()),
+ _inputTransparentViewContainer = new LayeredViewContainer<T> (Test.VisualElement.InputTransparent, new T { InputTransparent = true }),
+ IsEnabledStateViewContainer = new StateViewContainer<T> (Test.VisualElement.IsEnabled, new T { IsEnabled = true }),
+ _focusedEventViewContainer = new EventViewContainer<T> (Test.VisualElement.Focused, new T ()),
+ _unfocusedEventViewContainer = new EventViewContainer<T> (Test.VisualElement.Unfocused, new T ()),
+ _isVisibleStateViewContainer = new StateViewContainer<T> (Test.VisualElement.IsVisible, new T { IsVisible = true }),
+ _opacityViewContainer = new ViewContainer<T> (Test.VisualElement.Opacity, new T { Opacity = 0.5 }),
+ _rotationViewContainer = new ViewContainer<T> (Test.VisualElement.Rotation, new T { Rotation = 10 }),
+ _rotationXViewContainer = new ViewContainer<T> (Test.VisualElement.RotationX, new T { RotationX = 33 }),
+ _rotationYViewContainer = new ViewContainer<T> (Test.VisualElement.RotationY, new T { RotationY = 10 }),
+ _scaleViewContainer = new ViewContainer<T> (Test.VisualElement.Scale, new T { Scale = 0.5 }),
+ _translationXViewContainer = new ViewContainer<T> (Test.VisualElement.TranslationX, new T { TranslationX = 30 }),
+ _translationYViewContainer = new ViewContainer<T> (Test.VisualElement.TranslationY, new T { TranslationY = 30 }),
+ };
+
+ // Set state
+ IsEnabledStateViewContainer.StateChangeButton.Command = new Command (() => {
+ IsEnabledStateViewContainer.View.IsEnabled = !IsEnabledStateViewContainer.View.IsEnabled;
+ });
+ _isVisibleStateViewContainer.StateChangeButton.Command = new Command (() => {
+ _isVisibleStateViewContainer.View.IsVisible = !_isVisibleStateViewContainer.View.IsVisible;
+ });
+
+ _focusStateViewContainer.StateChangeButton.Command = new Command (() => {
+ if (_focusStateViewContainer.View.IsFocused) {
+ _focusStateViewContainer.View.Unfocus ();
+ } else {
+ _focusStateViewContainer.View.Focus ();
+ }
+ });
+
+ _focusedEventViewContainer.View.Focused += (sender, args) => _focusedEventViewContainer.EventFired ();
+ _unfocusedEventViewContainer.View.Unfocused += (sender, args) => _unfocusedEventViewContainer.EventFired ();
+
+ _gestureRecognizerEventViewContainer.View.GestureRecognizers.Add (
+ new TapGestureRecognizer {
+ Command = new Command (() => _gestureRecognizerEventViewContainer.EventFired ())
+ }
+ );
+
+ _views = new List<View> (viewContainers.Select (o => o.ContainerLayout));
+
+ _moveNextStack = new StackLayout ();
+ var moveNextButton = new Button ();
+ moveNextButton.Text = "Move Next";
+ moveNextButton.AutomationId = "MoveNextButton";
+ moveNextButton.Clicked += delegate (object sender, EventArgs e) {
+ if (!_views.Any ())
+ return;
+
+ if (_currentIndex + 1 >= _views.Count) {
+ return;
+ }
+
+ _currentIndex += 1;
+
+ _moveNextStack.Children.RemoveAt (2);
+ _moveNextStack.Children.Add (_views[_currentIndex]);
+ _picker.SelectedIndexChanged -= PickerSelectedIndexChanged;
+ _picker.SelectedIndex = _currentIndex;
+ _picker.SelectedIndexChanged += PickerSelectedIndexChanged;
+ };
+
+ _picker = new Picker();
+ foreach (var container in viewContainers) {
+ _picker.Items.Add(container.TitleLabel.Text);
+ }
+
+ _picker.SelectedIndex = _currentIndex;
+
+ _picker.SelectedIndexChanged += PickerSelectedIndexChanged;
+
+ _moveNextStack.Children.Add (_picker);
+ _moveNextStack.Children.Add (moveNextButton);
+ _moveNextStack.Children.Add (_views[_currentIndex]);
+
+ stackLayout.Children.Add (_moveNextStack);
+
+ if (!SupportsFocus) {
+ stackLayout.Children.Remove (_focusStateViewContainer.ContainerLayout);
+ stackLayout.Children.Remove (_isFocusedStateViewContainer.ContainerLayout);
+ }
+
+ if (!SupportsTapGestureRecognizer)
+ stackLayout.Children.Remove (_gestureRecognizerEventViewContainer.ContainerLayout);
+
+ foreach (var element in viewContainers)
+ InitializeElement (element.View);
+ }
+
+ void PickerSelectedIndexChanged (object sender, EventArgs eventArgs)
+ {
+ _currentIndex = _picker.SelectedIndex;
+ _moveNextStack.Children.RemoveAt (2);
+ _moveNextStack.Children.Add (_views[_currentIndex]);
+ }
+
+
+ protected virtual bool SupportsTapGestureRecognizer
+ {
+ get { return true; }
+ }
+
+ protected virtual bool SupportsFocus
+ {
+ get { return true; }
+ }
+
+ protected void Add (ViewContainer<T> view) {
+ _views.Add (view.ContainerLayout);
+ _picker.Items.Add(view.TitleLabel.Text);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/DatePickerCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/DatePickerCoreGalleryPage.cs
new file mode 100644
index 0000000..1dbb9bb
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/DatePickerCoreGalleryPage.cs
@@ -0,0 +1,34 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class DatePickerCoreGalleryPage : CoreGalleryPage<DatePicker>
+ {
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var dateContainer = new ViewContainer<DatePicker> (Test.DatePicker.Date, new DatePicker { Date = new DateTime (1987, 9, 13) });
+
+ var dateSelectedContainer = new EventViewContainer<DatePicker> (Test.DatePicker.DateSelected, new DatePicker ());
+ dateSelectedContainer.View.DateSelected += (sender, args) => dateSelectedContainer.EventFired ();
+
+ var formatDateContainer = new ViewContainer<DatePicker> (Test.DatePicker.Format, new DatePicker { Format = "ddd" });
+ var minimumDateContainer = new ViewContainer<DatePicker> (Test.DatePicker.MinimumDate, new DatePicker { MinimumDate = new DateTime (1987, 9, 13) });
+ var maximumDateContainer = new ViewContainer<DatePicker> (Test.DatePicker.MaximumDate, new DatePicker { MaximumDate = new DateTime (2087, 9, 13) });
+
+ Add (dateContainer);
+ Add (dateSelectedContainer);
+ Add (formatDateContainer);
+ Add (minimumDateContainer);
+ Add (maximumDateContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/EditorCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/EditorCoreGalleryPage.cs
new file mode 100644
index 0000000..d7c749b
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/EditorCoreGalleryPage.cs
@@ -0,0 +1,51 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class EditorCoreGalleryPage : CoreGalleryPage<Editor>
+ {
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var completedContainer = new EventViewContainer<Editor> (Test.Editor.Completed, new Editor ());
+ completedContainer.View.Completed += (sender, args) => completedContainer.EventFired ();
+
+ var textContainer = new ViewContainer<Editor> (Test.Editor.Text, new Editor { Text = "I have text" });
+
+ var textChangedContainer = new EventViewContainer<Editor> (Test.Editor.TextChanged, new Editor ());
+ textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired ();
+
+ var textFontAttributesContainer = new ViewContainer<Editor> (Test.Editor.FontAttributes, new Editor { Text = "I have italic text", FontAttributes = FontAttributes.Italic });
+ var textFamilyContainer1 = new ViewContainer<Editor> (Test.Editor.FontFamily, new Editor { Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS" });
+ var textFamilyContainer2 = new ViewContainer<Editor> (Test.Editor.FontFamily, new Editor { Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold });
+ var textFontSizeContainer = new ViewContainer<Editor> (Test.Editor.FontSize, new Editor { Text = "I have default size text" });
+ var textFontSizeDefaultContainer = new ViewContainer<Editor> (Test.Editor.FontSize, new Editor { Text = "I also have default size text" });
+ textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize (NamedSize.Default, textFontSizeDefaultContainer.View);
+ var textFontSizeLargeContainer = new ViewContainer<Editor> (Test.Editor.FontSize, new Editor { Text = "I have size 48 (huge) text", FontSize = 48 });
+
+ var textColorContainer = new ViewContainer<Editor> (Test.Editor.TextColor,
+ new Editor { Text = "I should have red text", TextColor = Color.Red });
+
+ var textColorDisabledContainer = new ViewContainer<Editor> (Test.Editor.TextColor,
+ new Editor { Text = "I should have the default disabled text color", TextColor = Color.Red, IsEnabled = false });
+
+ Add (completedContainer);
+ Add (textContainer);
+ Add (textChangedContainer);
+ Add (textFontAttributesContainer);
+ Add (textFamilyContainer1);
+ Add (textFamilyContainer2);
+ Add (textFontSizeContainer);
+ Add (textFontSizeDefaultContainer);
+ Add (textFontSizeLargeContainer);
+ Add (textColorContainer);
+ Add (textColorDisabledContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs
new file mode 100644
index 0000000..2180f1f
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs
@@ -0,0 +1,92 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class EntryCoreGalleryPage : CoreGalleryPage<Entry>
+ {
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var completedContainer = new EventViewContainer<Entry> (Test.Entry.Completed, new Entry { Placeholder = "Completed" });
+ completedContainer.View.Completed += (sender, args) => completedContainer.EventFired ();
+
+ var placeholderContainer = new ViewContainer<Entry> (Test.Entry.Placeholder, new Entry { Placeholder = "Placeholder" });
+ var keyboardContainer = new ViewContainer<Entry> (Test.InputView.Keyboard, new Entry { Keyboard = Keyboard.Numeric });
+ var isPasswordContainer = new ViewContainer<Entry> (Test.Entry.IsPassword, new Entry { IsPassword = true });
+ var textContainer = new ViewContainer<Entry> (Test.Entry.Text, new Entry { Text = "Hi, I am Text" });
+
+ var textChangedContainer = new EventViewContainer<Entry> (Test.Entry.TextChanged, new Entry ());
+ textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired ();
+
+ var textFontAttributesContainer = new ViewContainer<Entry> (Test.Entry.FontAttributes, new Entry { Text = "I have italic text", FontAttributes = FontAttributes.Italic });
+ var textFamilyContainer1 = new ViewContainer<Entry> (Test.Entry.FontFamily, new Entry { Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS" });
+ var textFamilyContainer2 = new ViewContainer<Entry> (Test.Entry.FontFamily, new Entry { Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold });
+ var textFontSizeContainer = new ViewContainer<Entry> (Test.Entry.FontSize, new Entry { Text = "I have default size text" });
+ var textFontSizeDefaultContainer = new ViewContainer<Entry> (Test.Entry.FontSize, new Entry { Text = "I also have default size text" });
+ textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize (NamedSize.Default, textFontSizeDefaultContainer.View);
+ var textFontSizeLargeContainer = new ViewContainer<Entry> (Test.Entry.FontSize, new Entry { Text = "I have size 48 (huge) text", FontSize = 48 });
+
+ var textColorContainer = new ViewContainer<Entry> (Test.Entry.TextColor, new Entry { Text = "Hi, I should be red", TextColor = Color.Red });
+
+ var xAlignCenterContainer = new ViewContainer<Entry> (Test.Entry.HorizontalTextAlignmentCenter,
+ new Entry { Text = "Should be centered", HorizontalTextAlignment = TextAlignment.Center });
+ var xAlignEndContainer = new ViewContainer<Entry> (Test.Entry.HorizontalTextAlignmentEnd,
+ new Entry { Text = "Should be aligned end", HorizontalTextAlignment = TextAlignment.End });
+ var xAlignStartContainer = new ViewContainer<Entry> (Test.Entry.HorizontalTextAlignmentStart,
+ new Entry { Text = "Should be aligned start", HorizontalTextAlignment = TextAlignment.Start });
+
+ var xAlignPlaceholderCenter = new ViewContainer<Entry> (Test.Entry.HorizontalTextAlignmentPlaceholderCenter,
+ new Entry { Placeholder = "Should be centered", HorizontalTextAlignment = TextAlignment.Center });
+ var xAlignPlaceholderEnd = new ViewContainer<Entry> (Test.Entry.HorizontalTextAlignmentPlaceholderEnd,
+ new Entry { Placeholder = "Should be aligned end", HorizontalTextAlignment = TextAlignment.End });
+ var xAlignPlaceholderStart = new ViewContainer<Entry> (Test.Entry.HorizontalTextAlignmentPlaceholderStart,
+ new Entry { Placeholder = "Should be aligned start", HorizontalTextAlignment = TextAlignment.Start });
+
+ var placeholderColorContainer = new ViewContainer<Entry> (Test.Entry.PlaceholderColor,
+ new Entry { Placeholder = "Hi, I should be red", PlaceholderColor = Color.Red });
+
+ var textColorDisabledContainer = new ViewContainer<Entry> (Test.Entry.TextDisabledColor,
+ new Entry { IsEnabled = false, Text = "I should be the default disabled color", TextColor = Color.Red });
+
+ var placeholderColorDisabledContainer = new ViewContainer<Entry> (Test.Entry.PlaceholderDisabledColor,
+ new Entry {
+ IsEnabled = false,
+ Placeholder = "I should be the default placeholder disabled color",
+ PlaceholderColor = Color.Red
+ });
+
+ var passwordColorContainer = new ViewContainer<Entry> (Test.Entry.PasswordColor,
+ new Entry { IsPassword = true, Text = "12345", TextColor = Color.Red });
+
+ Add (isPasswordContainer);
+ Add (completedContainer);
+ Add (placeholderContainer);
+ Add (keyboardContainer);
+ Add (textContainer);
+ Add (textChangedContainer);
+ Add (textColorContainer);
+ Add (xAlignPlaceholderCenter);
+ Add (xAlignCenterContainer);
+ Add (xAlignPlaceholderEnd);
+ Add (xAlignEndContainer);
+ Add (xAlignPlaceholderStart);
+ Add (xAlignStartContainer);
+ Add (textFontAttributesContainer);
+ Add (textFamilyContainer1);
+ Add (textFamilyContainer2);
+ Add (textFontSizeContainer);
+ Add (textFontSizeDefaultContainer);
+ Add (textFontSizeLargeContainer);
+ Add (placeholderColorContainer);
+ Add (textColorDisabledContainer);
+ Add (placeholderColorDisabledContainer);
+ Add (passwordColorContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/FrameCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/FrameCoreGalleryPage.cs
new file mode 100644
index 0000000..aa24172
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/FrameCoreGalleryPage.cs
@@ -0,0 +1,36 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class FrameCoreGalleryPage : CoreGalleryPage<Frame>
+ {
+ // TODO
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (Frame element)
+ {
+ element.HeightRequest = 50;
+ element.WidthRequest = 100;
+ element.OutlineColor = Color.Olive;
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var hasShadowContainer = new StateViewContainer<Frame> (Test.Frame.HasShadow, new Frame { HasShadow = true });
+ var outlineColorContainer = new StateViewContainer<Frame> (Test.Frame.OutlineColor, new Frame { OutlineColor = Color.Teal, });
+ var viewContainer = new StateViewContainer<Frame> (Test.Frame.OutlineColor, new Frame {
+ OutlineColor = Color.Teal,
+ Content = new Label { Text = "I am a frame" }
+ });
+
+ Add (hasShadowContainer);
+ Add (outlineColorContainer);
+ Add (viewContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ImageCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ImageCoreGalleryPage.cs
new file mode 100644
index 0000000..8657e3c
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/ImageCoreGalleryPage.cs
@@ -0,0 +1,56 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ImageCoreGalleryPage : CoreGalleryPage<Image>
+ {
+ static readonly Random Rand = new Random ();
+
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (Image element)
+ {
+// var sourceIndex = rand.Next (0, 3);
+//
+// var sources = new [] {
+// ImageSource.FromFile ("oasis.jpg"),
+// //ImageSource.FromUri (new Uri("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg")),
+// //ImageSource.FromResource ("Xamarin.Forms.Controls.ControlGalleryPages.crimson.jpg")
+// };
+
+ //element.Source = sources[sourceIndex];
+ element.Source = "oasissmall.jpg";
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var aspectFillContainer = new ViewContainer<Image> (Test.Image.AspectFill, new Image { Aspect = Aspect.AspectFill });
+ var aspectFitContainer = new ViewContainer<Image> (Test.Image.AspectFit, new Image { Aspect = Aspect.AspectFit });
+ var fillContainer = new ViewContainer<Image> (Test.Image.Fill, new Image { Aspect = Aspect.Fill });
+ var isLoadingContainer = new StateViewContainer<Image> (Test.Image.IsLoading, new Image ());
+ var isOpaqueContainer = new StateViewContainer<Image> (Test.Image.IsOpaque, new Image ());
+
+ InitializeElement (aspectFillContainer.View);
+ InitializeElement (aspectFitContainer.View);
+ InitializeElement (fillContainer.View);
+ InitializeElement (isLoadingContainer.View);
+ InitializeElement (isOpaqueContainer.View);
+
+ var sourceContainer = new ViewContainer<Image> (Test.Image.Source, new Image { Source = "http://sethrosetter.com/images/projects/bezierdraw/bezierdraw_5.jpg" });
+
+ Add (aspectFillContainer);
+ Add (aspectFitContainer);
+ Add (fillContainer);
+ Add (isLoadingContainer);
+ Add (isOpaqueContainer);
+ Add (sourceContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/KeyboardCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/KeyboardCoreGalleryPage.cs
new file mode 100644
index 0000000..cf5f213
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/KeyboardCoreGalleryPage.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class KeyboardCoreGallery : ContentPage
+ {
+ public KeyboardCoreGallery ()
+ {
+ var keyboardTypes = new[] {
+ Keyboard.Chat,
+ Keyboard.Default,
+ Keyboard.Email,
+ Keyboard.Numeric,
+ Keyboard.Telephone,
+ Keyboard.Text,
+ Keyboard.Url
+ };
+
+ var layout = new StackLayout ();
+
+ foreach (var keyboardType in keyboardTypes) {
+ var viewContainer = new ViewContainer<Entry> (Test.Entry.Keyboard, new Entry { Placeholder = keyboardType.ToString (), Keyboard = keyboardType } );
+ layout.Children.Add (viewContainer.ContainerLayout);
+ }
+
+ var customKeyboards = new [] {
+ Tuple.Create ("Suggestions", Keyboard.Create (KeyboardFlags.Suggestions)),
+ Tuple.Create ("Spellcheck", Keyboard.Create (KeyboardFlags.Spellcheck)),
+ Tuple.Create ("SpellcheckSuggestions", Keyboard.Create (KeyboardFlags.Spellcheck | KeyboardFlags.Suggestions)),
+ Tuple.Create ("Capitalize", Keyboard.Create (KeyboardFlags.CapitalizeSentence)),
+ Tuple.Create ("CapitalizeSuggestions", Keyboard.Create (KeyboardFlags.CapitalizeSentence | KeyboardFlags.Suggestions)),
+ Tuple.Create ("CapitalizeSpellcheck", Keyboard.Create (KeyboardFlags.CapitalizeSentence | KeyboardFlags.Spellcheck)),
+ Tuple.Create ("CapitalizeSpellcheckSuggestions", Keyboard.Create (KeyboardFlags.CapitalizeSentence | KeyboardFlags.Spellcheck | KeyboardFlags.Suggestions)),
+ Tuple.Create ("All", Keyboard.Create (KeyboardFlags.All)),
+ };
+
+ foreach (var customKeyboard in customKeyboards) {
+ var viewContainer = new ViewContainer<Entry> (Test.Entry.Keyboard, new Entry { Placeholder = customKeyboard.Item1, Keyboard = customKeyboard.Item2 } );
+ layout.Children.Add (viewContainer.ContainerLayout);
+ }
+
+ Content = new ScrollView { Content = layout };
+ }
+
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs
new file mode 100644
index 0000000..9043c70
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs
@@ -0,0 +1,158 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class LabelCoreGalleryPage : CoreGalleryPage<Label>
+ {
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (Label element)
+ {
+ element.Text = "I am a label's text.";
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var namedSizeMediumBoldContainer = new ViewContainer<Label> (Test.Label.FontAttibutesBold, new Label { Text = "Medium Bold Font", Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Bold) });
+ var namedSizeMediumItalicContainer = new ViewContainer<Label> (Test.Label.FontAttributesItalic, new Label { Text = "Medium Italic Font", Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Italic) });
+ var namedSizeLargeContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeLarge, new Label { Text = "Large Font", Font = Font.SystemFontOfSize (NamedSize.Large) });
+ var namedSizeMediumContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeMedium, new Label { Text = "Medium Font", Font = Font.SystemFontOfSize (NamedSize.Medium) });
+ var namedSizeMicroContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeMicro, new Label { Text = "Micro Font", Font = Font.SystemFontOfSize (NamedSize.Micro) });
+ var namedSizeSmallContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeSmall, new Label { Text = "Small Font", Font = Font.SystemFontOfSize (NamedSize.Small) });
+
+ var formattedString = new FormattedString ();
+ formattedString.Spans.Add (new Span { BackgroundColor = Color.Red, ForegroundColor = Color.Olive, Text = "Span 1 " });
+ formattedString.Spans.Add (new Span { BackgroundColor = Color.Black, ForegroundColor = Color.White, Text = "Span 2 " });
+ formattedString.Spans.Add (new Span { BackgroundColor = Color.Pink, ForegroundColor = Color.Purple, Text = "Span 3" });
+
+ var formattedTextContainer = new ViewContainer<Label> (Test.Label.FormattedText, new Label { FormattedText = formattedString });
+
+ const string longText = "Lorem ipsum dolor sit amet, cu mei malis petentium, dolor tempor delicata no qui, eos ex vitae utinam vituperata. Utroque habemus philosophia ut mei, doctus placerat eam cu. An inermis scaevola pro, quo legimus deleniti ei, equidem docendi urbanitas ea eum. Saepe doctus ut pri. Nec ex wisi dolorem. Duo dolor vituperatoribus ea. Id purto instructior per. Nec partem accusamus ne. Qui ad saepe accumsan appellantur, duis omnesque has et, vim nihil nemore scaevola ne. Ei populo appetere recteque cum, meliore splendide appellantur vix id.";
+ var lineBreakModeCharacterWrapContainer = new ViewContainer<Label> (Test.Label.LineBreakModeCharacterWrap, new Label { Text = longText, LineBreakMode = LineBreakMode.CharacterWrap });
+ var lineBreakModeHeadTruncationContainer = new ViewContainer<Label> (Test.Label.LineBreakModeHeadTruncation, new Label { Text = longText, LineBreakMode = LineBreakMode.HeadTruncation });
+ var lineBreakModeMiddleTruncationContainer = new ViewContainer<Label> (Test.Label.LineBreakModeMiddleTruncation, new Label { Text = longText, LineBreakMode = LineBreakMode.MiddleTruncation });
+ var lineBreakModeNoWrapContainer = new ViewContainer<Label> (Test.Label.LineBreakModeNoWrap, new Label { Text = longText, LineBreakMode = LineBreakMode.NoWrap });
+ var lineBreakModeTailTruncationContainer = new ViewContainer<Label> (Test.Label.LineBreakModeTailTruncation, new Label { Text = longText, LineBreakMode = LineBreakMode.TailTruncation });
+ var lineBreakModeWordWrapContainer = new ViewContainer<Label> (Test.Label.LineBreakModeWordWrap, new Label { Text = longText, LineBreakMode = LineBreakMode.WordWrap });
+
+ var textContainer = new ViewContainer<Label> (Test.Label.Text, new Label { Text = "I should have text" });
+ var textColorContainer = new ViewContainer<Label> (Test.Label.TextColor, new Label { Text = "I should have lime text", TextColor = Color.Lime });
+
+ const int alignmentTestsHeightRequest = 100;
+ const int alignmentTestsWidthRequest = 100;
+
+ var xAlignCenterContainer = new ViewContainer<Label> (Test.Label.HorizontalTextAlignmentCenter,
+ new Label {
+ Text = "HorizontalTextAlignment Center",
+ HorizontalTextAlignment = TextAlignment.Center,
+ HeightRequest = alignmentTestsHeightRequest,
+ WidthRequest = alignmentTestsWidthRequest
+ }
+ );
+
+ var xAlignEndContainer = new ViewContainer<Label> (Test.Label.HorizontalTextAlignmentEnd,
+ new Label {
+ Text = "HorizontalTextAlignment End",
+ HorizontalTextAlignment = TextAlignment.End,
+ HeightRequest = alignmentTestsHeightRequest,
+ WidthRequest = alignmentTestsWidthRequest
+ }
+ );
+
+ var xAlignStartContainer = new ViewContainer<Label> (Test.Label.HorizontalTextAlignmentStart,
+ new Label {
+ Text = "HorizontalTextAlignment Start",
+ HorizontalTextAlignment = TextAlignment.Start,
+ HeightRequest = alignmentTestsHeightRequest,
+ WidthRequest = alignmentTestsWidthRequest
+ }
+ );
+
+ var yAlignCenterContainer = new ViewContainer<Label> (Test.Label.VerticalTextAlignmentCenter,
+ new Label {
+ Text = "VerticalTextAlignment Start",
+ VerticalTextAlignment = TextAlignment.Center,
+ HeightRequest = alignmentTestsHeightRequest,
+ WidthRequest = alignmentTestsWidthRequest
+ }
+ );
+
+ var yAlignEndContainer = new ViewContainer<Label> (Test.Label.VerticalTextAlignmentEnd,
+ new Label {
+ Text = "VerticalTextAlignment End",
+ VerticalTextAlignment = TextAlignment.End,
+ HeightRequest = alignmentTestsHeightRequest,
+ WidthRequest = alignmentTestsWidthRequest
+ }
+ );
+
+ var yAlignStartContainer = new ViewContainer<Label> (Test.Label.VerticalTextAlignmentStart,
+ new Label {
+ Text = "VerticalTextAlignment Start",
+ VerticalTextAlignment = TextAlignment.Start,
+ HeightRequest = alignmentTestsHeightRequest,
+ WidthRequest = alignmentTestsWidthRequest
+ }
+ );
+
+ var styleTitleContainer = new ViewContainer<Label> (Test.Device.Styles,
+ new Label {
+ Text = "Device.Styles.TitleStyle",
+ Style = Device.Styles.TitleStyle
+ }
+ );
+
+ var styleSubtitleContainer = new ViewContainer<Label> (Test.Device.Styles,
+ new Label {
+ Text = "Device.Styles.SubtitleStyle",
+ Style = Device.Styles.SubtitleStyle
+ }
+ );
+
+ var styleBodyContainer = new ViewContainer<Label> (Test.Device.Styles,
+ new Label {
+ Text = "Device.Styles.BodyStyle",
+ Style = Device.Styles.BodyStyle
+ }
+ );
+
+ var styleCaptionContainer = new ViewContainer<Label> (Test.Device.Styles,
+ new Label {
+ Text = "Device.Styles.CaptionStyle",
+ Style = Device.Styles.CaptionStyle,
+ }
+ );
+
+ Add (namedSizeMediumBoldContainer);
+ Add (namedSizeMediumItalicContainer);
+ Add (namedSizeLargeContainer);
+ Add (namedSizeMediumContainer);
+ Add (namedSizeMicroContainer);
+ Add (namedSizeSmallContainer);
+ Add (formattedTextContainer);
+ Add (lineBreakModeCharacterWrapContainer);
+ Add (lineBreakModeHeadTruncationContainer);
+ Add (lineBreakModeMiddleTruncationContainer);
+ Add (lineBreakModeNoWrapContainer);
+ Add (lineBreakModeTailTruncationContainer);
+ Add (lineBreakModeWordWrapContainer);
+ Add (textContainer);
+ Add (textColorContainer);
+ Add (xAlignCenterContainer);
+ Add (xAlignEndContainer);
+ Add (xAlignStartContainer);
+ Add (yAlignCenterContainer);
+ Add (yAlignEndContainer);
+ Add (yAlignStartContainer);
+ Add (styleTitleContainer);
+ Add (styleSubtitleContainer);
+ Add (styleBodyContainer);
+ Add (styleCaptionContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs
new file mode 100644
index 0000000..ddcd7ce
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs
@@ -0,0 +1,268 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ internal class ListViewCoreGalleryPage : CoreGalleryPage<ListView>
+ {
+ internal class Employee : INotifyPropertyChanged
+ {
+ string _name;
+ public string Name
+ {
+ get { return _name; }
+ set
+ {
+ if (value != null && value != _name) {
+ _name = value;
+ OnPropertyChanged ();
+ }
+ }
+ }
+
+ TimeSpan _daysWorked;
+ public TimeSpan DaysWorked
+ {
+ get { return _daysWorked; }
+ set
+ {
+ if (value != null && value != _daysWorked) {
+ _daysWorked = value;
+ OnPropertyChanged ();
+ }
+ }
+ }
+
+ int _rowHeight;
+ public int RowHeight
+ {
+ get { return _rowHeight; }
+ set
+ {
+ if (value != null && value != _rowHeight) {
+ _rowHeight = value;
+ OnPropertyChanged ();
+ }
+ }
+ }
+
+ public Employee (string name, TimeSpan daysWorked, int rowHeight)
+ {
+ _name = name;
+ _daysWorked = daysWorked;
+ _rowHeight = rowHeight;
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged ([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null)
+ handler (this, new PropertyChangedEventArgs (propertyName));
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal class Grouping<K, T> : ObservableCollection<T>
+ {
+ public K Key { get; private set; }
+
+ public Grouping (K key, IEnumerable<T> items)
+ {
+ Key = key;
+ foreach (T item in items) {
+ Items.Add (item);
+ }
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ public class HeaderCell : ViewCell
+ {
+ public HeaderCell ()
+ {
+ Height = 60;
+ var title = new Label {
+ HeightRequest = 60,
+ BackgroundColor = Color.Navy,
+ TextColor = Color.White
+ };
+
+ title.SetBinding (Label.TextProperty, new Binding ("Key"));
+
+ View = new StackLayout {
+ BackgroundColor = Color.Pink,
+ Children = { title }
+ };
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ class UnevenCell : ViewCell
+ {
+ public UnevenCell ()
+ {
+
+ SetBinding (HeightProperty, new Binding("RowHeight"));
+
+ var label = new Label ();
+ label.SetBinding (Label.TextProperty, new Binding("Name"));
+
+ var layout = new StackLayout {
+ BackgroundColor = Color.Red,
+ Children = {
+ label
+ }
+ };
+
+ View = layout;
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal class ListViewViewModel
+ {
+ public ObservableCollection<Grouping<string, Employee>> CategorizedEmployees { get; private set; }
+ public ObservableCollection<Employee> Employees { get; private set; }
+
+ public ListViewViewModel ()
+ {
+ CategorizedEmployees = new ObservableCollection<Grouping<string, Employee>> {
+ new Grouping<string, Employee> (
+ "Engineer",
+ new [] {
+ new Employee ("Seth", TimeSpan.FromDays (10), 60),
+ new Employee ("Jason", TimeSpan.FromDays (100), 100),
+ new Employee ("Eric", TimeSpan.FromDays (1000), 160),
+ }
+ ),
+ new Grouping<string, Employee> (
+ "Sales",
+ new [] {
+ new Employee ("Andrew 1", TimeSpan.FromDays (10), 160),
+ new Employee ("Andrew 2", TimeSpan.FromDays (100), 100),
+ new Employee ("Andrew 3", TimeSpan.FromDays (1000), 60),
+ }
+ ),
+ };
+
+ Employees = new ObservableCollection<Employee> {
+ new Employee ("Seth", TimeSpan.FromDays (10), 60),
+ new Employee ("Jason", TimeSpan.FromDays (100), 100),
+ new Employee ("Eric", TimeSpan.FromDays (1000), 160),
+ new Employee ("Andrew 1", TimeSpan.FromDays (10), 160),
+ new Employee ("Andrew 2", TimeSpan.FromDays (100), 100),
+ new Employee ("Andrew 3", TimeSpan.FromDays (1000), 60),
+ };
+
+ Enumerable.Range (0, 9000).Select (e => new Employee (e.ToString (), TimeSpan.FromDays (1), 60)).ForEach (e => Employees.Add (e));
+ }
+ }
+
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (ListView element)
+ {
+ element.HeightRequest = 350;
+ element.RowHeight = 60;
+
+ var viewModel = new ListViewViewModel ();
+ element.BindingContext = viewModel;
+
+ element.ItemsSource = viewModel.Employees;
+
+ var template = new DataTemplate (typeof(TextCell));
+ template.SetBinding (TextCell.TextProperty, "Name");
+ template.SetBinding (TextCell.DetailProperty, new Binding("DaysWorked", converter: new GenericValueConverter (time => time.ToString ())));
+
+ element.ItemTemplate = template;
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var viewModel = new ListViewViewModel ();
+
+ var groupDisplayBindingContainer = new ViewContainer<ListView> (Test.ListView.GroupDisplayBinding, new ListView ());
+ InitializeElement (groupDisplayBindingContainer.View);
+ groupDisplayBindingContainer.View.ItemsSource = viewModel.CategorizedEmployees;
+ groupDisplayBindingContainer.View.IsGroupingEnabled = true;
+ groupDisplayBindingContainer.View.GroupDisplayBinding = new Binding ("Key");
+
+
+ var groupHeaderTemplateContainer = new ViewContainer<ListView> (Test.ListView.GroupHeaderTemplate, new ListView ());
+ InitializeElement (groupHeaderTemplateContainer.View);
+ groupHeaderTemplateContainer.View.ItemsSource = viewModel.CategorizedEmployees;
+ groupHeaderTemplateContainer.View.IsGroupingEnabled = true;
+ groupHeaderTemplateContainer.View.GroupHeaderTemplate = new DataTemplate (typeof (HeaderCell));
+
+ var groupShortNameContainer = new ViewContainer<ListView> (Test.ListView.GroupShortNameBinding, new ListView ());
+ InitializeElement (groupShortNameContainer.View);
+ groupShortNameContainer.View.ItemsSource = viewModel.CategorizedEmployees;
+ groupShortNameContainer.View.IsGroupingEnabled = true;
+ groupShortNameContainer.View.GroupShortNameBinding = new Binding("Key");
+
+ // TODO - not sure how to do this
+ var hasUnevenRowsContainer = new ViewContainer<ListView> (Test.ListView.HasUnevenRows, new ListView ());
+ InitializeElement (hasUnevenRowsContainer.View);
+ hasUnevenRowsContainer.View.HasUnevenRows = true;
+ hasUnevenRowsContainer.View.ItemTemplate = new DataTemplate (typeof(UnevenCell));
+
+ var isGroupingEnabledContainer = new StateViewContainer<ListView> (Test.ListView.IsGroupingEnabled, new ListView ());
+ InitializeElement (isGroupingEnabledContainer.View);
+ isGroupingEnabledContainer.View.ItemsSource = viewModel.CategorizedEmployees;
+ isGroupingEnabledContainer.View.IsGroupingEnabled = true;
+ isGroupingEnabledContainer.StateChangeButton.Clicked += (sender, args) => isGroupingEnabledContainer.View.IsGroupingEnabled = !isGroupingEnabledContainer.View.IsGroupingEnabled;
+
+
+ var itemAppearingContainer = new EventViewContainer<ListView> (Test.ListView.ItemAppearing, new ListView ());
+ InitializeElement (itemAppearingContainer.View);
+ itemAppearingContainer.View.ItemAppearing += (sender, args) => itemAppearingContainer.EventFired ();
+
+ var itemDisappearingContainer = new EventViewContainer<ListView> (Test.ListView.ItemDisappearing, new ListView ());
+ InitializeElement (itemDisappearingContainer.View);
+ itemDisappearingContainer.View.ItemDisappearing += (sender, args) => itemDisappearingContainer.EventFired ();
+
+ var itemSelectedContainer = new EventViewContainer<ListView> (Test.ListView.ItemSelected, new ListView ());
+ InitializeElement (itemSelectedContainer.View);
+ itemSelectedContainer.View.ItemSelected += (sender, args) => itemSelectedContainer.EventFired ();
+
+ var itemTappedContainer = new EventViewContainer<ListView> (Test.ListView.ItemTapped, new ListView ());
+ InitializeElement (itemTappedContainer.View);
+ itemTappedContainer.View.ItemTapped += (sender, args) => itemTappedContainer.EventFired ();
+
+ // TODO
+ var rowHeightContainer = new ViewContainer<ListView> (Test.ListView.RowHeight, new ListView ());
+ InitializeElement (rowHeightContainer.View);
+
+ var selectedItemContainer = new ViewContainer<ListView> (Test.ListView.SelectedItem, new ListView ());
+ InitializeElement (selectedItemContainer.View);
+ selectedItemContainer.View.SelectedItem = viewModel.Employees[2];
+
+ Add (groupDisplayBindingContainer);
+ Add (groupHeaderTemplateContainer);
+ Add (groupShortNameContainer);
+ Add (hasUnevenRowsContainer);
+ Add (isGroupingEnabledContainer);
+ Add (itemAppearingContainer);
+ Add (itemDisappearingContainer);
+ Add (itemSelectedContainer);
+ Add (itemTappedContainer);
+ Add (rowHeightContainer);
+ Add (selectedItemContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/OpenGLViewCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/OpenGLViewCoreGalleryPage.cs
new file mode 100644
index 0000000..d057ca9
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/OpenGLViewCoreGalleryPage.cs
@@ -0,0 +1,16 @@
+namespace Xamarin.Forms.Controls
+{
+ internal class OpenGLViewCoreGalleryPage : CoreGalleryPage<OpenGLView>
+ {
+ // TODO
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/PickerCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/PickerCoreGalleryPage.cs
new file mode 100644
index 0000000..cea755d
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/PickerCoreGalleryPage.cs
@@ -0,0 +1,35 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class PickerCoreGalleryPage : CoreGalleryPage<Picker>
+ {
+ // TODO
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ var itemsContainer = new ViewContainer<Picker> (Test.Picker.Items, new Picker ());
+ itemsContainer.View.Items.Add ("Item 1");
+ itemsContainer.View.Items.Add ("Item 2");
+ itemsContainer.View.Items.Add ("Item 3");
+
+ var selectedIndexContainer = new ViewContainer<Picker> (Test.Picker.SelectedIndex, new Picker ());
+ selectedIndexContainer.View.Items.Add ("Item 1");
+ selectedIndexContainer.View.Items.Add ("Item 2");
+ selectedIndexContainer.View.Items.Add ("Item 3");
+ selectedIndexContainer.View.SelectedIndex = 2;
+
+ var titleContainer = new ViewContainer<Picker> (Test.Picker.Title, new Picker ());
+ titleContainer.View.Title = "Title";
+
+ Add (itemsContainer);
+ Add (selectedIndexContainer);
+ Add (titleContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ProgressBarCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ProgressBarCoreGalleryPage.cs
new file mode 100644
index 0000000..1cc51ae
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/ProgressBarCoreGalleryPage.cs
@@ -0,0 +1,27 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ProgressBarCoreGalleryPage : CoreGalleryPage<ProgressBar>
+ {
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (ProgressBar element)
+ {
+ base.InitializeElement (element);
+
+ element.Progress = 1;
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var progressContainer = new ViewContainer<ProgressBar> (Test.ProgressBar.Progress, new ProgressBar { Progress = 0.5 });
+ Add (progressContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs
new file mode 100644
index 0000000..0221b87
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs
@@ -0,0 +1,89 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class SearchBarCoreGalleryPage : CoreGalleryPage<SearchBar>
+ {
+ // TODO
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ var placeholderContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceHolder, new SearchBar { Placeholder = "Placeholder" });
+
+ var searchButtonPressedContainer = new EventViewContainer<SearchBar> (Test.SearchBar.SearchButtonPressed, new SearchBar { });
+ searchButtonPressedContainer.View.SearchButtonPressed += (sender, args) => searchButtonPressedContainer.EventFired ();
+
+ var searchCommandContainer = new ViewContainer<SearchBar> (Test.SearchBar.SearchCommand,
+ new SearchBar {
+ SearchCommand = new Command (async () => await DisplayAlert ("Search command", "Fired", "Ok"))
+ }
+ );
+
+ var textContainer = new ViewContainer<SearchBar> (Test.SearchBar.Text, new SearchBar { Text = "I am text" });
+
+ var textChangedContainer = new EventViewContainer<SearchBar> (Test.SearchBar.TextChanged, new SearchBar { Placeholder = "I am text changed" });
+ textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired ();
+
+ var cancelButtonColor = new ViewContainer<SearchBar> (
+ Test.SearchBar.CancelButtonColor,
+ new SearchBar {
+ Placeholder = "Should have a red cancel button",
+ CancelButtonColor = Color.Red
+ }
+ );
+
+ var textFontAttributesContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontAttributes, new SearchBar { Text = "I have italic text", FontAttributes = FontAttributes.Italic });
+ var textFamilyContainer1 = new ViewContainer<SearchBar> (Test.SearchBar.FontFamily, new SearchBar { Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS" });
+ var textFamilyContainer2 = new ViewContainer<SearchBar> (Test.SearchBar.FontFamily, new SearchBar { Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold });
+ var textFontSizeContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontSize, new SearchBar { Text = "I have default size text" });
+ var textFontSizeDefaultContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontSize, new SearchBar { Text = "I also have default size text" });
+ textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize (NamedSize.Default, textFontSizeDefaultContainer.View);
+ var textFontSizeLargeContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontSize, new SearchBar { Text = "I have size 48 (huge) text", FontSize = 48 });
+
+ var textAlignmentStartContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextAlignmentStart,
+ new SearchBar { Text = "I should be at the start", HorizontalTextAlignment = TextAlignment.Start });
+ var textAlignmentCenterContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextAlignmentCenter,
+ new SearchBar { Text = "I should be centered", HorizontalTextAlignment = TextAlignment.Center });
+ var textAlignmentEndContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextAlignmentEnd,
+ new SearchBar { Text = "I should be at the end", HorizontalTextAlignment = TextAlignment.End });
+
+ var placeholderAlignmentStartContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderAlignmentStart,
+ new SearchBar { Placeholder = "I should be at the start", HorizontalTextAlignment = TextAlignment.Start });
+ var placeholderAlignmentCenterContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderAlignmentCenter,
+ new SearchBar { Placeholder = "I should be centered", HorizontalTextAlignment = TextAlignment.Center });
+ var placeholderAlignmentEndContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderAlignmentEnd,
+ new SearchBar { Placeholder = "I should be at the end", HorizontalTextAlignment = TextAlignment.End });
+
+ var textColorContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextColor,
+ new SearchBar { Text = "I should be red", TextColor = Color.Red });
+
+ var placeholderColorContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderColor,
+ new SearchBar { Placeholder = "I should be red", PlaceholderColor = Color.Red });
+ Add (placeholderContainer);
+ Add (searchButtonPressedContainer);
+ Add (searchCommandContainer);
+ Add (textContainer);
+ Add (textChangedContainer);
+ Add (textFontAttributesContainer);
+ Add (textFamilyContainer1);
+ Add (textFamilyContainer2);
+ Add (textFontSizeContainer);
+ Add (textFontSizeDefaultContainer);
+ Add (textFontSizeLargeContainer);
+ Add (cancelButtonColor);
+ Add (textAlignmentStartContainer);
+ Add (textAlignmentCenterContainer);
+ Add (textAlignmentEndContainer);
+ Add (placeholderAlignmentStartContainer);
+ Add (placeholderAlignmentCenterContainer);
+ Add (placeholderAlignmentEndContainer);
+ Add (textColorContainer);
+ Add (placeholderColorContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/SliderCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/SliderCoreGalleryPage.cs
new file mode 100644
index 0000000..be81311
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/SliderCoreGalleryPage.cs
@@ -0,0 +1,29 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class SliderCoreGalleryPage : CoreGalleryPage<Slider>
+ {
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ var maximumContainer = new ValueViewContainer<Slider> (Test.Slider.Maximum, new Slider { Maximum = 10, Minimum = 5 }, "Value", value => value.ToString ());
+ var minimumContainer = new ValueViewContainer<Slider> (Test.Slider.Minimum, new Slider { Maximum = 10 }, "Value", value => value.ToString ());
+ var valueContainer = new ValueViewContainer<Slider> (Test.Slider.Value, new Slider { Value = 0.5 }, "Value", value => value.ToString ());
+
+ Add (maximumContainer);
+ Add (minimumContainer);
+ Add (valueContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/StepperCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/StepperCoreGalleryPage.cs
new file mode 100644
index 0000000..2ff1546
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/StepperCoreGalleryPage.cs
@@ -0,0 +1,29 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class StepperCoreGalleryPage : CoreGalleryPage<Stepper>
+ {
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ var maximumContainer = new ValueViewContainer<Stepper> (Test.Stepper.Maximum, new Stepper { Maximum = 10 }, "Value", value => value.ToString ());
+ var minimumContainer = new ValueViewContainer<Stepper> (Test.Stepper.Minimum, new Stepper { Minimum = 2 }, "Value", value => value.ToString ());
+ var incrememtContainer = new ValueViewContainer<Stepper> (Test.Stepper.Increment, new Stepper { Maximum = 20, Minimum = 10, Increment = 2 }, "Value", value => value.ToString ());
+
+ Add (maximumContainer);
+ Add (minimumContainer);
+ Add (incrememtContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/SwitchCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/SwitchCoreGalleryPage.cs
new file mode 100644
index 0000000..5d9ebcf
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/SwitchCoreGalleryPage.cs
@@ -0,0 +1,25 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class SwitchCoreGalleryPage : CoreGalleryPage<Switch>
+ {
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var isToggledContainer = new ValueViewContainer<Switch> (Test.Switch.IsToggled, new Switch (), "IsToggled", value => value.ToString ());
+ Add (isToggledContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/TableViewCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/TableViewCoreGalleryPage.cs
new file mode 100644
index 0000000..f5c7a07
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/TableViewCoreGalleryPage.cs
@@ -0,0 +1,16 @@
+namespace Xamarin.Forms.Controls
+{
+ internal class TableViewCoreGalleryPage : CoreGalleryPage<TableView>
+ {
+ // TODO
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/TimePickerCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/TimePickerCoreGalleryPage.cs
new file mode 100644
index 0000000..bf8b9c9
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/TimePickerCoreGalleryPage.cs
@@ -0,0 +1,24 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class TimePickerCoreGalleryPage : CoreGalleryPage<TimePicker>
+ {
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ var formatContainer = new ViewContainer<TimePicker> (Test.TimePicker.Format, new TimePicker { Format = "HH-mm-ss" });
+ var timeContainer = new ViewContainer<TimePicker> (Test.TimePicker.Time, new TimePicker { Time = new TimeSpan (14, 45, 50) });
+
+ Add (formatContainer);
+ Add (timeContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/WebViewCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/WebViewCoreGalleryPage.cs
new file mode 100644
index 0000000..229aed3
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/WebViewCoreGalleryPage.cs
@@ -0,0 +1,62 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class WebViewCoreGalleryPage : CoreGalleryPage<WebView>
+ {
+ protected override bool SupportsFocus
+ {
+ get { return false; }
+ }
+
+ protected override void InitializeElement (WebView element)
+ {
+ element.HeightRequest = 200;
+
+ element.Source = new UrlWebViewSource { Url = "http://xamarin.com/" };
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+
+ var urlWebViewSourceContainer = new ViewContainer<WebView> (Test.WebView.UrlWebViewSource,
+ new WebView {
+ Source = new UrlWebViewSource { Url = "https://www.google.com/" },
+ HeightRequest = 200
+ }
+ );
+
+ const string html = "<html><div class=\"test\"><h2>I am raw html</h2></div></html>";
+ var htmlWebViewSourceContainer = new ViewContainer<WebView> (Test.WebView.HtmlWebViewSource,
+ new WebView {
+ Source = new HtmlWebViewSource { Html = html },
+ HeightRequest = 200
+ }
+ );
+
+ var htmlFileWebSourceContainer = new ViewContainer<WebView> (Test.WebView.LoadHtml,
+ new WebView {
+ Source = new HtmlWebViewSource {
+ Html = @"<html>
+<head>
+<link rel=""stylesheet"" href=""default.css"">
+</head>
+<body>
+<h1>Xamarin.Forms</h1>
+<p>The CSS and image are loaded from local files!</p>
+<img src='WebImages/XamarinLogo.png'/>
+<p><a href=""local.html"">next page</a></p>
+</body>
+</html>"
+ },
+ HeightRequest = 200
+ }
+ );
+
+ Add (urlWebViewSourceContainer);
+ Add (htmlWebViewSourceContainer);
+ Add (htmlFileWebSourceContainer);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/AbsoluteLayoutGallery.cs b/Xamarin.Forms.Controls/GalleryPages/AbsoluteLayoutGallery.cs
new file mode 100644
index 0000000..b38798f
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/AbsoluteLayoutGallery.cs
@@ -0,0 +1,151 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ internal class AbsolutePositioningExplorationViewModel : INotifyPropertyChanged
+ {
+ double _rectangleX = 0.5;
+ double _rectangleY = 0.5;
+ double _rectangleWidth = 0.5;
+ double _rectangleHeight = 0.5;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged ([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null)
+ handler (this, new PropertyChangedEventArgs (propertyName));
+ }
+
+ public double RectangleX
+ {
+ get { return _rectangleX; }
+ set
+ {
+ if (_rectangleX == value)
+ return;
+ _rectangleX = value;
+ OnPropertyChanged ();
+ OnPropertyChanged ("Rectangle");
+ }
+ }
+
+ public double RectangleY
+ {
+ get { return _rectangleY; }
+ set
+ {
+ if (_rectangleY == value)
+ return;
+ _rectangleY = value;
+ OnPropertyChanged ();
+ OnPropertyChanged ("Rectangle");
+ }
+ }
+
+ public double RectangleWidth
+ {
+ get { return _rectangleWidth; }
+ set
+ {
+ if (_rectangleWidth == value)
+ return;
+ _rectangleWidth = value;
+ OnPropertyChanged ();
+ OnPropertyChanged ("Rectangle");
+ }
+ }
+
+ public double RectangleHeight
+ {
+ get { return _rectangleHeight; }
+ set
+ {
+ if (_rectangleHeight == value)
+ return;
+ _rectangleHeight = value;
+ OnPropertyChanged ();
+ OnPropertyChanged ("Rectangle");
+ }
+ }
+
+ public Rectangle Rectangle
+ {
+ get { return new Rectangle(RectangleX, RectangleY, RectangleWidth, RectangleHeight); }
+ }
+ }
+ public class AbsoluteLayoutGallery : ContentPage
+ {
+ public AbsoluteLayoutGallery ()
+ {
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ BindingContext = new AbsolutePositioningExplorationViewModel ();
+ var absLayout = new AbsoluteLayout {
+ BackgroundColor = Color.Gray,
+ VerticalOptions = LayoutOptions.FillAndExpand
+ };
+
+ var rect = new BoxView {Color = Color.Lime};
+
+ var xSlider = new Slider ();
+ var ySlider = new Slider ();
+ var widthSlider = new Slider ();
+ var heightSlider = new Slider ();
+
+ var grid = new Grid {
+ Padding = 10,
+ RowSpacing = 0,
+ ColumnDefinitions = {
+ new ColumnDefinition {Width = GridLength.Auto},
+ new ColumnDefinition {Width = new GridLength (1, GridUnitType.Star)}
+ }
+ };
+
+ grid.Children.Add (new Label {Text = "X:", VerticalTextAlignment = TextAlignment.Center}, 0, 0);
+ grid.Children.Add (xSlider, 1, 0);
+
+ grid.Children.Add (new Label {Text = "Y:", VerticalTextAlignment = TextAlignment.Center}, 0, 1);
+ grid.Children.Add (ySlider, 1, 1);
+
+ grid.Children.Add (new Label {Text = "Width:", VerticalTextAlignment = TextAlignment.Center}, 0, 2);
+ grid.Children.Add (widthSlider, 1, 2);
+
+ grid.Children.Add (new Label {Text = "Height:", VerticalTextAlignment = TextAlignment.Center}, 0, 3);
+ grid.Children.Add (heightSlider, 1, 3);
+
+ absLayout.Children.Add (rect);
+
+ var mainLayout = new StackLayout {
+ Spacing = 0,
+ Children = {
+ absLayout,
+ grid
+ }
+ };
+
+ rect.SetBinding (AbsoluteLayout.LayoutBoundsProperty, "Rectangle");
+ AbsoluteLayout.SetLayoutFlags (rect, AbsoluteLayoutFlags.All);
+
+ xSlider.SetBinding (Slider.ValueProperty, new Binding ("RectangleX", BindingMode.TwoWay));
+ ySlider.SetBinding (Slider.ValueProperty, new Binding ("RectangleY", BindingMode.TwoWay));
+ widthSlider.SetBinding (Slider.ValueProperty, new Binding ("RectangleWidth", BindingMode.TwoWay));
+ heightSlider.SetBinding (Slider.ValueProperty, new Binding ("RectangleHeight", BindingMode.TwoWay));
+
+ //Content = new ScrollView {Content = mainLayout};
+ Content = mainLayout;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ActionSheetGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ActionSheetGallery.cs
new file mode 100644
index 0000000..4f60c1e
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ActionSheetGallery.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ActionSheetGallery : ContentPage
+ {
+ public ActionSheetGallery ()
+ {
+ AutomationId = "ActionSheetPage";
+
+ var extras = new string[] {
+ "Extra One",
+ "Extra Two",
+ "Extra Three",
+ "Extra Four",
+ "Extra Five",
+ "Extra Six",
+ "Extra Seven",
+ "Extra Eight",
+ "Extra Nine",
+ "Extra Ten",
+ "Extra Eleven",
+ };
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Spacing = 0,
+ Children = {
+ MakeActionSheetButton (this, "ActionSheet Cancel", null, "Cancel", null),
+ MakeActionSheetButton (this, "ActionSheet Cancel Extras", null, "Cancel", null, extras),
+ MakeActionSheetButton (this, "ActionSheet Cancel Destruction", null, "Cancel", "Destruction"),
+ MakeActionSheetButton (this, "ActionSheet Cancel Destruction Extras", null, "Cancel", "Destruction", extras),
+ MakeActionSheetButton (this, "ActionSheet Destruction", null, null, "Destruction"),
+ MakeActionSheetButton (this, "ActionSheet Destruction Extras", null, null, "Destruction", extras),
+ MakeActionSheetButton (this, "ActionSheet Extras", null, null, null, extras),
+ MakeActionSheetButton (this, "ActionSheet Title", "Title", null, null),
+ MakeActionSheetButton (this, "ActionSheet Title Cancel", "Title", "Cancel", null),
+ MakeActionSheetButton (this, "ActionSheet Title Cancel Extras", "Title", "Cancel", null, extras),
+ MakeActionSheetButton (this, "ActionSheet Title Cancel Destruction", "Title", "Cancel", "Destruction"),
+ MakeActionSheetButton (this, "ActionSheet Title Cancel Destruction Extras", "Title", "Cancel", "Destruction", extras),
+ MakeActionSheetButton (this, "ActionSheet Title Destruction", "Title", null, "Destruction"),
+ MakeActionSheetButton (this, "ActionSheet Title Destruction Extras", "Title", null, "Destruction", extras),
+ MakeActionSheetButton (this, "ActionSheet Title Extras", "Title", null, null, extras),
+ }
+ }
+ };
+ }
+
+ static Button MakeActionSheetButton (Page page, string buttonText, string title, string cancel, string destruction, params string[] extras)
+ {
+ var actionSheetButton = new Button {
+ Text = buttonText
+ };
+
+ actionSheetButton.Clicked += async (sender, e) => await page.DisplayActionSheet (title, cancel, destruction, extras);
+
+ return actionSheetButton;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/AlertGallery.cs b/Xamarin.Forms.Controls/GalleryPages/AlertGallery.cs
new file mode 100644
index 0000000..8a666a1
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/AlertGallery.cs
@@ -0,0 +1,28 @@
+using System;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ public class AlertGallery : ContentPage
+ {
+ public AlertGallery ()
+ {
+ var lblResult = new Label { Text = "Result: ", AutomationId = "testResult" };
+
+ var btn1 = new Button { Text = "Alert Override1", AutomationId = "test1" };
+ btn1.Clicked += async (sender, e) => {
+ await DisplayAlert ("TheAlertTitle", "TheAlertMessage", "TheCancelButton");;
+ };
+
+ var btn2 = new Button { Text = "Alert Override2", AutomationId = "test2" };
+ btn2.Clicked += async (sender, e) => {
+ var result = await DisplayAlert ("TheAlertTitle", "TheAlertMessage", "TheAcceptButton", "TheCancelButton");
+ lblResult.Text = string.Format("Result: {0}", result);
+ };
+
+ Content = new StackLayout { Children = { lblResult, btn1, btn2 }};
+ }
+ }
+}
+
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/BackgroundImageGallery.cs b/Xamarin.Forms.Controls/GalleryPages/BackgroundImageGallery.cs
new file mode 100644
index 0000000..7282a0e
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/BackgroundImageGallery.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class BackgroundImageGallery
+ : ContentPage
+ {
+ public BackgroundImageGallery ()
+ {
+ var contentIntabs = new Button { Text = "Tabbed children" };
+ contentIntabs.Clicked += async (sender, args) => {
+ await Navigation.PushModalAsync (new TabbedPage {
+ ItemTemplate = new DataTemplate (() => {
+ var page = new ContentPage();
+ page.SetBinding (BackgroundImageProperty, ".");
+ return page;
+ }),
+
+ ItemsSource = new[] {
+ "oasis.jpg",
+ "crimson.jpg"
+ }
+ /*ItemsSource = new[] {
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-21.jpg",
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-31.jpg",
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-61.jpg",
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-71.jpg"
+ };*/
+ });
+ };
+
+ var contentInCarosel = new Button { Text = "Carousel children" };
+ contentInCarosel.Clicked += async (sender, args) => {
+ await Navigation.PushModalAsync (new CarouselPage {
+ ItemTemplate = new DataTemplate (() => {
+ var page = new ContentPage();
+ page.SetBinding (BackgroundImageProperty, ".");
+ return page;
+ }),
+
+ ItemsSource = new[] {
+ "oasis.jpg",
+ "crimson.jpg"
+ }
+ /*ItemsSource = new[] {
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-21.jpg",
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-31.jpg",
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-61.jpg",
+ "http://www.zemwallpaper.com/wp-content/uploads/2014/05/Desktop-background-download-71.jpg"
+ };*/
+ });
+ };
+
+ var navigation = new Button { Text = "NavigationPage"};
+ navigation.Clicked += async (sender, args) => {
+ await Navigation.PushModalAsync (new NavigationPage (new ContentPage {
+ Content = new Label {
+ Text = "Text",
+ FontSize = 42
+ }})
+ {
+ BackgroundImage = "oasis.jpg"
+ }
+ );
+ };
+
+ var carousel = new Button { Text = "CarouselPage" };
+ carousel.Clicked += async (sender, args) => {
+ await Navigation.PushAsync (new CarouselPage {
+ BackgroundImage = "crimson.jpg",
+ ItemsSource = new[] { "test1", "test2" }
+ });
+ };
+
+ var tabbed = new Button { Text = "TabbedPage" };
+ tabbed.Clicked += async (sender, args) => {
+ await Navigation.PushAsync (new TabbedPage {
+ BackgroundImage = "crimson.jpg",
+ ItemsSource = new[] { "test1", "test2" }
+ });
+ };
+
+ var master = new Button { Text = "MasterDetail" };
+ master.Clicked += async (sender, args) => {
+ await Navigation.PushModalAsync (new MasterDetailPage {
+ Master = new ContentPage { Title = "Master" },
+ Detail = new ContentPage(),
+ BackgroundImage = "crimson.jpg",
+ });
+ };
+
+ Content = new StackLayout {
+ Children = {
+ navigation,
+ carousel,
+ tabbed,
+ master,
+ contentIntabs,
+ contentInCarosel
+ }
+
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/BoundContentPage.cs b/Xamarin.Forms.Controls/GalleryPages/BoundContentPage.cs
new file mode 100644
index 0000000..e3051fd
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/BoundContentPage.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Globalization;
+using System.Windows.Input;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class BoundContentPage : ContentPage
+ {
+ internal class NavWrapperConverter : IValueConverter
+ {
+ public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return new NavigationWrapper ((INavigation) value);
+ }
+ }
+
+ internal class NavigationWrapper
+ {
+ // This class is dumb but proves you can wrap the INavigation with a converter to do some MVVM goodness
+ // Normally this class would implement pushes with ViewModel then do the conversion
+ readonly INavigation _inner;
+
+ public NavigationWrapper (INavigation inner )
+ {
+ _inner = inner;
+ }
+
+ public void WrappedPush ()
+ {
+ _inner.PushAsync (new ContentPage {
+ Content = new StackLayout {
+ BackgroundColor = Color.Red,
+ Children = {
+ new Label {
+ Text = "Second Page"
+ }
+ }
+ }
+ });
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal class BoundContentPageViewModel
+ {
+ public string ButtonText { get { return "Click Me!"; } }
+
+ public ICommand ButtonCommand { get; set; }
+
+ public NavigationWrapper Navigation { get; set; }
+
+ public BoundContentPageViewModel ()
+ {
+ ButtonCommand = new Command (() => Navigation.WrappedPush ());
+ }
+ }
+
+ public BoundContentPage ()
+ {
+ Title ="Bound Gallery";
+
+ BindingContext = new BoundContentPageViewModel ();
+
+ var button = new Button ();
+ button.SetBinding (Button.TextProperty, "ButtonText");
+ button.SetBinding (Button.CommandProperty, "ButtonCommand");
+
+ SetBinding (NavigationProperty, new Binding ("Navigation", converter: new NavWrapperConverter ()));
+
+ Content = button;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs
new file mode 100644
index 0000000..bb27601
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs
@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ButtonGallery : ContentPage
+ {
+ public ButtonGallery ()
+ {
+ BackgroundColor = new Color (0.9);
+
+ var normal = new Button { Text = "Normal Button" };
+ normal.Effects.Add (Effect.Resolve ("XamControl.BorderEffect"));
+
+ var disabled = new Button { Text = "Disabled Button"};
+ var disabledswitch = new Switch ();
+ disabledswitch.SetBinding (Switch.IsToggledProperty, "IsEnabled");
+ disabledswitch.BindingContext = disabled;
+
+ var canTapLabel = new Label {
+ Text = "Cannot Tap"
+ };
+
+ disabled.Clicked += (sender, e) => {
+ canTapLabel.Text = "TAPPED!";
+ };
+
+ var click = new Button { Text = "Click Button" };
+ var rotate = new Button { Text = "Rotate Button" };
+ var transparent = new Button { Text = "Transparent Button" };
+
+ var fontName = Device.OnPlatform ("Georgia", "sans-serif-light", "Comic Sans MS");
+ var font = Font.OfSize (fontName, NamedSize.Medium);
+
+ var themedButton = new Button {
+ Text = "Accent Button",
+ BackgroundColor = Color.Accent,
+ TextColor = Color.White,
+ ClassId = "AccentButton",
+ Font = font
+ };
+ var borderButton = new Button {
+ Text = "Border Button",
+ BorderColor = Color.Black,
+ BackgroundColor = Color.Purple,
+ BorderWidth = 5,
+ BorderRadius = 5
+ };
+ var timer = new Button { Text = "Timer" };
+ var busy = new Button { Text = "Toggle Busy" };
+ var alert = new Button { Text = "Alert" };
+ var alertSingle = new Button {Text = "Alert Single"};
+ var image = new Button { Text = "Image Button", Image = new FileImageSource {File = "bank.png"}, BackgroundColor = Color.Blue.WithLuminosity (.8) };
+
+ themedButton.Clicked += (sender, args) => themedButton.Font = Font.Default;
+
+ alertSingle.Clicked += (sender, args) => DisplayAlert ("Foo", "Bar", "Cancel");
+
+ disabled.IsEnabled = false;
+ int i = 1;
+ click.Clicked += (sender, e) => { click.Text = "Clicked " + i++; };
+ rotate.Clicked += (sender, e) => rotate.RelRotateTo (180);
+ transparent.Opacity = .5;
+
+ int j = 1;
+ timer.Clicked += (sender, args) => Device.StartTimer (TimeSpan.FromSeconds (1), () => {
+ timer.Text = "Timer Elapsed " + j++;
+ return j < 4;
+ });
+
+ bool isBusy = false;
+ busy.Clicked += (sender, args) => IsBusy = isBusy = !isBusy;
+
+ alert.Clicked += async (sender, args) => {
+ var result = await DisplayAlert ("User Alert", "This is a user alert. This is only a user alert.", "Accept", "Cancel");
+ alert.Text = result ? "Accepted" : "Cancelled";
+ };
+
+ borderButton.Clicked += (sender, args) => borderButton.BackgroundColor = Color.Default;
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Padding = new Size (20, 20),
+ Children = {
+ normal,
+ new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children={
+ disabled,
+ disabledswitch,
+ },
+ },
+ canTapLabel,
+ click,
+ rotate,
+ transparent,
+ themedButton,
+ borderButton,
+ new Button {Text = "Thin Border", BorderWidth = 1, BackgroundColor=Color.White, BorderColor = Color.Black, TextColor = Color.Black},
+ new Button {Text = "Thinner Border", BorderWidth = .5, BackgroundColor=Color.White, BorderColor = Color.Black, TextColor = Color.Black},
+ timer,
+ busy,
+ alert,
+ alertSingle,
+ image,
+ }
+ }
+ };
+
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/CarouselPageGallery.cs b/Xamarin.Forms.Controls/GalleryPages/CarouselPageGallery.cs
new file mode 100644
index 0000000..478b301
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CarouselPageGallery.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+
+ public class CarouselPageGallery : CarouselPage
+ {
+ public CarouselPageGallery ()
+ {
+ var pageOneLabel = new Label {
+ Text = "No click one"
+ };
+
+ var pageTwoLabel = new Label {
+ Text = "No click two"
+ };
+
+ var pageThreeLabel = new Label {
+ Text = "No click three"
+ };
+
+ var pageOneButton = new Button {
+ Text = "Click me one",
+ Command = new Command (() => pageOneLabel.Text = "Clicked one")
+ };
+
+ var pageTwoButton = new Button {
+ Text = "Click me two",
+ Command = new Command (() => pageTwoLabel.Text = "Clicked two")
+ };
+
+ var pageThreeButton = new Button {
+ Text = "Click me three",
+ Command = new Command (() => pageThreeLabel.Text = "Clicked three")
+ };
+
+ Children.Add (new ContentPage {
+ Title = "Page One",
+ BackgroundColor = new Color (1, 0, 0),
+ Content = new StackLayout {
+ Children = {
+ pageOneLabel,
+ pageOneButton
+ }
+ }
+ });
+
+ Children.Add (new ContentPage {
+ Title = "Page Two",
+ BackgroundColor = new Color (0, 1, 0),
+ Content = new StackLayout {
+ Children = {
+ pageTwoLabel,
+ pageTwoButton
+ }
+ }
+ });
+
+ Children.Add (new ContentPage {
+ Title = "Page Three",
+ BackgroundColor = new Color (0, 0, 1),
+ Content = new StackLayout {
+ Children = {
+ pageThreeLabel,
+ pageThreeButton
+ }
+ }
+ });
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/CarouselViewGallery.cs b/Xamarin.Forms.Controls/GalleryPages/CarouselViewGallery.cs
new file mode 100644
index 0000000..87f741c
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CarouselViewGallery.cs
@@ -0,0 +1,292 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Collections.ObjectModel;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public sealed class CarouselViewGallaryPage : ContentPage // or TestMasterDetailPage, etc ...
+ {
+ public abstract class Item
+ {
+ static int s_id = 0;
+
+ int id;
+
+ internal Item()
+ {
+ id = s_id++;
+ }
+
+ public int Id => id;
+ public string TypeName => GetType ().Name;
+ }
+ public sealed class Foo : Item { }
+ public sealed class Bar : Item { }
+ public sealed class Baz : Item { }
+ public sealed class Poo : Item { }
+ public sealed class Moo : Item { }
+
+ [Preserve (AllMembers = true)]
+ public sealed class ItemView : ContentView
+ {
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create (
+ propertyName: nameof(TextColor),
+ returnType: typeof (Color),
+ declaringType: typeof (ItemView),
+ defaultValue: Color.White,
+ defaultBindingMode: BindingMode.TwoWay
+ );
+ public static readonly BindableProperty ContextProperty = BindableProperty.Create (
+ propertyName: nameof(Context),
+ returnType: typeof (CarouselView),
+ declaringType: typeof (ItemView),
+ defaultBindingMode: BindingMode.TwoWay
+ );
+
+ public ItemView ()
+ {
+
+ var change = CreateButton("Change", (items, index) => items[index] = new Moo ());
+
+ var removeBar = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ Children = {
+ CreateButton ("- Left", (items, index) => items.RemoveAt (index - 1)),
+ CreateButton ("Remove", (items, index) => items.RemoveAt (index)),
+ CreateButton ("- Right", (items, index) => items.RemoveAt (index + 1)),
+ }
+ };
+
+ var addBar = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ Children = {
+ CreateButton ("+ Left", (items, index) => items.Insert (index, new Moo ())),
+ CreateButton ("+ Right", (items, index) => {
+ if (index == items.Count - 1)
+ items.Add (new Moo ());
+ else
+ items.Insert (index + 1, new Moo ());
+ }),
+ }
+ };
+
+ var typeNameLabel = new Label () { StyleId = "typename" };
+ typeNameLabel.SetBinding (Label.TextProperty, nameof(Item.TypeName));
+
+ var idLabel = new Label () { StyleId = "id", TextColor = Color.White };
+ idLabel.SetBinding (Label.TextProperty, nameof(Item.Id));
+
+ Content = new StackLayout {
+ Children = {
+ typeNameLabel,
+ idLabel,
+ change,
+ removeBar,
+ addBar,
+ }
+ };
+
+ PropertyChanged += (s, e) => {
+ if (e.PropertyName == "TextColor")
+ typeNameLabel.TextColor = TextColor;
+ };
+ }
+
+ Button CreateButton(string text, Action<IList<Item>, int> clicked)
+ {
+ var button = new Button ();
+ button.Text = text;
+ button.Clicked += (s, e) => {
+ var items = (IList<Item>)Context.ItemsSource;
+ var index = items.IndexOf (BindingContext);
+ clicked (items, index);
+ };
+ return button;
+ }
+
+ public CarouselView Context
+ {
+ get { return (CarouselView)GetValue (ContextProperty); }
+ set { SetValue (ContextProperty, value); }
+ }
+ public Color TextColor
+ {
+ get { return (Color)GetValue(TextColorProperty); }
+ set { SetValue(TextColorProperty, value); }
+ }
+ }
+ public sealed class MyDataTemplateSelector : DataTemplateSelector
+ {
+ Dictionary<Type, Color> m_colorByType = new Dictionary<Type, Color> ();
+ Dictionary<Type, DataTemplate> m_dataTemplateByType = new Dictionary<Type, DataTemplate> ();
+
+ public MyDataTemplateSelector()
+ {
+ m_colorByType[typeof (Foo)] = Color.Green;
+ m_colorByType[typeof (Bar)] = Color.Red;
+ }
+
+ protected override DataTemplate OnSelectTemplate (object item, BindableObject container)
+ {
+ return OnSelectTemplate (item.GetType (), container);
+ }
+
+ DataTemplate OnSelectTemplate (Type itemType, BindableObject container)
+ {
+ DataTemplate dataTemplate;
+ if (!m_dataTemplateByType.TryGetValue(itemType, out dataTemplate))
+ m_dataTemplateByType[itemType] = dataTemplate = CreateTemplate(itemType, container);
+ return dataTemplate;
+ }
+
+ DataTemplate CreateTemplate(Type itemType, BindableObject container)
+ {
+ var dataTemplate = new DataTemplate (typeof (ItemView));
+
+ Color color;
+ if (!m_colorByType.TryGetValue (itemType, out color)) {
+ color = Color.Pink;
+ dataTemplate.SetValue (BackgroundColorProperty, Color.Black);
+ } else {
+ dataTemplate.SetValue (BackgroundColorProperty, Color.Blue);
+ }
+
+ dataTemplate.SetValue (ItemView.TextColorProperty, color);
+ dataTemplate.SetValue (ItemView.ContextProperty, container);
+ return dataTemplate;
+ }
+ }
+
+ static readonly MyDataTemplateSelector Selector = new MyDataTemplateSelector ();
+
+ static readonly IList<Item> Items = new ObservableCollection<Item> () {
+ new Baz(),
+ new Poo(),
+ new Foo(),
+ new Bar(),
+ };
+
+ Button CreateButton(string text, Action onClicked = null)
+ {
+ var button = new Button {
+ Text = text
+ };
+
+ if (onClicked != null)
+ button.Clicked += (s, e) => onClicked();
+
+ return button;
+ }
+
+ public CarouselViewGallaryPage ()
+ {
+ BackgroundColor = Color.Blue;
+
+ var logLabel = new Label () { TextColor = Color.White };
+ var selectedItemLabel = new Label () { TextColor = Color.White, Text = "0" };
+ var selectedPositionLabel = new Label () { TextColor = Color.White, Text = "@0" };
+ //var appearingLabel = new Label () { TextColor = Color.White };
+ //var disappearingLabel = new Label () { TextColor = Color.White };
+
+ var carouselView = new CarouselView {
+ BackgroundColor = Color.Purple,
+ ItemsSource = Items,
+ ItemTemplate = Selector,
+ Position = 1
+ };
+
+ bool capture = false;
+ carouselView.ItemSelected += (s, o) => {
+ var item = (Item)o.SelectedItem;
+ selectedItemLabel.Text = $"{item.Id}";
+ if (capture)
+ logLabel.Text += $"({item.Id}) ";
+ };
+ carouselView.PositionSelected += (s, o) => {
+ var position = (int)o.SelectedPosition;
+ selectedPositionLabel.Text = $"@{position}=={carouselView.Position}";
+ if (capture)
+ logLabel.Text += $"(@{position}) ";
+ };
+ //carouselView.ItemDisappearing += (s, o) => {
+ // var item = (Item)o.Item;
+ // var id = item.Id;
+ // disappearingLabel.Text = $"-{id}";
+ // if (capture)
+ // logLabel.Text += $"(-{id}) ";
+ //};
+ //carouselView.ItemAppearing += (s, o) => {
+ // var item = (Item)o.Item;
+ // var id = item.Id;
+ // appearingLabel.Text = $"+{id}";
+ // if (capture)
+ // logLabel.Text += $"(+{id}) ";
+ //};
+
+ var moveBar = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ Children = {
+ CreateButton ("<<", () => carouselView.Position = 0),
+ CreateButton ("<", () => { try { carouselView.Position--; } catch { } }),
+ CreateButton (">", () => { try { carouselView.Position++; } catch { } }),
+ CreateButton (">>", () => carouselView.Position = Items.Count - 1)
+ }
+ };
+
+ var statusBar = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ selectedItemLabel,
+ selectedPositionLabel,
+ //disappearingLabel,
+ //appearingLabel,
+ }
+ };
+
+ var logBar = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ CreateButton ("Clear", () => logLabel.Text = ""),
+ CreateButton ("On/Off", () => capture = !capture ),
+ logLabel,
+ }
+ };
+
+ Content = new StackLayout {
+ Children = {
+ carouselView,
+ moveBar,
+ statusBar,
+ logBar
+ }
+ };
+ }
+
+#if UITEST
+ //[Test]
+ //public void CarouselViewTest ()
+ //{
+ // var app = RunningApp;
+ // app.Screenshot ("I am at Issue 1");
+ // app.WaitForElement (q => q.Marked ("Remove"));
+
+ // app.Screenshot ("I see the Label");
+ // app.SwipeRight ();
+ // app.SwipeLeft ();
+ //}
+#endif
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellTypeList.cs b/Xamarin.Forms.Controls/GalleryPages/CellTypeList.cs
new file mode 100644
index 0000000..4298bc8
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellTypeList.cs
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class CellTypesListPage : ContentPage
+ {
+ public CellTypesListPage ()
+ {
+ Content = new CellTypeList ();
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ public class CellNavigation
+ {
+ public string CellType { get; set; }
+ public ContentPage Page { get; set; }
+
+ public CellNavigation (string type, ContentPage page)
+ {
+ CellType = type;
+ Page = page;
+ }
+ }
+
+ public class CellTypeList : ListView
+ {
+ // TODO Add gallerys for ViewCell, ListView and TableView
+ public CellTypeList ()
+ {
+ var itemList = new List<CellNavigation> {
+ new CellNavigation ("TextCell List", new TextCellListPage ()),
+ new CellNavigation ("TextCell Table", new TextCellTablePage ()),
+ new CellNavigation ("ImageCell List", new ImageCellListPage ()),
+ new CellNavigation ("ImageCell Url List", new UrlImageCellListPage()),
+ new CellNavigation ("ImageCell Table", new ImageCellTablePage ()),
+ new CellNavigation ("SwitchCell List", new SwitchCellListPage ()),
+ new CellNavigation ("SwitchCell Table", new SwitchCellTablePage ()),
+ new CellNavigation ("EntryCell List", new EntryCellListPage ()),
+ new CellNavigation ("EntryCell Table", new EntryCellTablePage ()),
+ new CellNavigation ("ViewCell Image url table", new UrlImageViewCellListPage())
+ };
+
+ ItemsSource = itemList;
+
+ var template = new DataTemplate (typeof (TextCell));
+ template.SetBinding (TextCell.TextProperty, new Binding ("CellType"));
+
+ ItemTemplate = template;
+ ItemSelected += (s, e) => {
+ if (SelectedItem == null)
+ return;
+
+ var cellNav = (CellNavigation) e.SelectedItem;
+ Navigation.PushAsync (cellNav.Page);
+ SelectedItem = null;
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs
new file mode 100644
index 0000000..b70a9f8
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs
@@ -0,0 +1,54 @@
+using System.Linq;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class EntryCellTest {
+ public string Label { get; set; }
+ public string Placeholder { get; set; }
+ public Color LabelColor { get; set; }
+ public Color PlaceholderColor { get; set; }
+
+ }
+
+ public class EntryCellListPage : ContentPage
+ {
+ public EntryCellListPage ()
+ {
+ Title = "EntryCell List Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var dataTemplate = new DataTemplate (typeof(EntryCell));
+ dataTemplate.SetBinding (EntryCell.LabelProperty, new Binding ("Label"));
+ dataTemplate.SetBinding (EntryCell.LabelColorProperty, new Binding ("LabelColor"));
+ dataTemplate.SetBinding (EntryCell.PlaceholderProperty, new Binding ("Placeholder"));
+
+ var label = new Label {
+ Text = "I have not been selected"
+ };
+
+ var listView = new ListView {
+ ItemsSource = Enumerable.Range (0, 100).Select (i => new EntryCellTest {
+ Label = "Label " + i,
+ LabelColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Placeholder = "Placeholder " + i,
+ PlaceholderColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ }),
+ ItemTemplate = dataTemplate
+ };
+
+ listView.ItemSelected += (sender, args) => {
+ label.Text = "I have been selected";
+ };
+
+
+
+ Content = new StackLayout { Children = { label, listView } };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs
new file mode 100644
index 0000000..c37dd44
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs
@@ -0,0 +1,85 @@
+namespace Xamarin.Forms.Controls
+{
+ public class EntryCellTablePage : ContentPage
+ {
+ public EntryCellTablePage ()
+ {
+ Title = "EntryCell Table Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ int timesEntered = 1;
+
+ var entryCell = new EntryCell { Label = "Enter text", Placeholder = "I am a placeholder" };
+ entryCell.Completed += (sender, args) => {
+ ((EntryCell)sender).Label = "Entered: " + timesEntered;
+ timesEntered++;
+ };
+
+ var tableSection = new TableSection ("Section One") {
+ new EntryCell { Label = "disabled", Placeholder = "disabled", IsEnabled = false },
+ new EntryCell { Label = "Text 2" },
+ new EntryCell { Label = "Text 3", Placeholder = "Placeholder 2" },
+ new EntryCell { Label = "Text 4" },
+ new EntryCell { Label = "Text 5", Placeholder = "Placeholder 3" },
+ new EntryCell { Label = "Text 6" },
+ new EntryCell { Label = "Text 7", Placeholder = "Placeholder 4" },
+ new EntryCell { Label = "Text 8" },
+ new EntryCell { Label = "Text 9", Placeholder = "Placeholder 5" },
+ new EntryCell { Label = "Text 10" },
+ new EntryCell { Label = "Text 11", Placeholder = "Placeholder 6" },
+ new EntryCell { Label = "Text 12" },
+ new EntryCell { Label = "Text 13", Placeholder = "Placeholder 7" },
+ new EntryCell { Label = "Text 14" },
+ new EntryCell { Label = "Text 15", Placeholder = "Placeholder 8" },
+ new EntryCell { Label = "Text 16" },
+ entryCell
+ };
+
+ var tableSectionTwo = new TableSection ("Section Two") {
+ new EntryCell { Label = "Text 17", Placeholder = "Placeholder 9" },
+ new EntryCell { Label = "Text 18" },
+ new EntryCell { Label = "Text 19", Placeholder = "Placeholder 10" },
+ new EntryCell { Label = "Text 20" },
+ new EntryCell { Label = "Text 21", Placeholder = "Placeholder 11" },
+ new EntryCell { Label = "Text 22" },
+ new EntryCell { Label = "Text 23", Placeholder = "Placeholder 12" },
+ new EntryCell { Label = "Text 24" },
+ new EntryCell { Label = "Text 25", Placeholder = "Placeholder 13" },
+ new EntryCell { Label = "Text 26" },
+ new EntryCell { Label = "Text 27", Placeholder = "Placeholder 14" },
+ new EntryCell { Label = "Text 28" },
+ new EntryCell { Label = "Text 29", Placeholder = "Placeholder 15" },
+ new EntryCell { Label = "Text 30" },
+ new EntryCell { Label = "Text 31", Placeholder = "Placeholder 16" },
+ new EntryCell { Label = "Text 32" },
+ };
+
+ var keyboards = new TableSection ("Keyboards") {
+ new EntryCell { Label = "Chat", Keyboard = Keyboard.Chat },
+ new EntryCell { Label = "Default", Keyboard = Keyboard.Default },
+ new EntryCell { Label = "Email", Keyboard = Keyboard.Email },
+ new EntryCell { Label = "Numeric", Keyboard = Keyboard.Numeric },
+ new EntryCell { Label = "Telephone", Keyboard = Keyboard.Telephone },
+ new EntryCell { Label = "Text", Keyboard = Keyboard.Text },
+ new EntryCell { Label = "Url", Keyboard = Keyboard.Url }
+ };
+
+ var root = new TableRoot ("Text Cell table") {
+ tableSection,
+ tableSectionTwo,
+ keyboards
+ };
+
+ var table = new TableView {
+ Root = root
+ };
+
+ Content = table;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs
new file mode 100644
index 0000000..1f58a33
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs
@@ -0,0 +1,121 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class ImageCellTest {
+ public object Text { get; set; }
+ public object TextColor { get; set; }
+ public object Detail { get; set; }
+ public object DetailColor { get; set; }
+ public object Image { get; set; }
+ }
+
+ public class ImageCellListPage : ContentPage
+ {
+
+ public ImageCellListPage ()
+ {
+ Title = "ImageCell List Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var dataTemplate = new DataTemplate (typeof (ImageCell));
+ var stringToImageSourceConverter = new GenericValueConverter (
+ obj => new FileImageSource {
+ File = (string) obj
+ }
+ );
+
+ dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text"));
+ dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor"));
+ dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail"));
+ dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor"));
+ dataTemplate.SetBinding (ImageCell.ImageSourceProperty, new Binding ("Image", converter: stringToImageSourceConverter));
+
+ Random rand = new Random(250);
+
+ var albums = new [] {
+ "crimsonsmall.jpg",
+ "oasissmall.jpg",
+ "cover1small.jpg"
+ };
+
+ var label = new Label { Text = "I have not been selected" };
+
+ var listView = new ListView {
+ AutomationId = "ImageCellListView",
+ ItemsSource = Enumerable.Range (0, 100).Select (i => new ImageCellTest {
+ Text = "Text " + i,
+ TextColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Detail = "Detail " + i,
+ DetailColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Image = albums[rand.Next(0,3)]
+ }),
+ ItemTemplate = dataTemplate
+ };
+
+ listView.ItemSelected += (sender, args) => label.Text = "I was selected";
+
+ Content = new StackLayout { Children = { label, listView } };
+
+ }
+ }
+
+ public class UrlImageCellListPage : ContentPage
+ {
+ public UrlImageCellListPage()
+ {
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var dataTemplate = new DataTemplate (typeof (ImageCell));
+ var stringToImageSourceConverter = new GenericValueConverter (
+ obj => new UriImageSource() {
+ Uri = new Uri ((string) obj)
+ });
+
+ dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text"));
+ dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor"));
+ dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail"));
+ dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor"));
+ dataTemplate.SetBinding (ImageCell.ImageSourceProperty,
+ new Binding ("Image", converter: stringToImageSourceConverter));
+
+ var albums = new List<string> ();
+ for (int i = 0; i < 30; i++) {
+ albums.Add (string.Format ("http://cdn.instructables.com/FCP/9TOJ/GCJ0ZQV5/FCP9TOJGCJ0ZQV5.MEDIUM.jpg?ticks={0}",i ));
+ }
+
+
+ var random = new Random();
+ var label = new Label { Text = "I have not been selected" };
+
+ var listView = new ListView {
+ AutomationId = "ImageUrlCellListView",
+ ItemsSource = Enumerable.Range (0, 300).Select (i => new ImageCellTest {
+ Text = "Text " + i,
+ TextColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Detail = "Detail " + i,
+ DetailColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Image = albums [random.Next (0, albums.Count - 1)]
+ }),
+ ItemTemplate = dataTemplate
+ };
+
+ listView.ItemSelected += (sender, args) => label.Text = "I was selected";
+
+ Content = new StackLayout { Children = { label, listView } };
+
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs
new file mode 100644
index 0000000..2b941bf
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs
@@ -0,0 +1,68 @@
+namespace Xamarin.Forms.Controls
+{
+ public class ImageCellTablePage : ContentPage
+ {
+
+ public ImageCellTablePage ()
+ {
+ Title = "ImageCell Table Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var tableSection = new TableSection ("Section One") {
+ new ImageCell { Text = "Text 1", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 2", Detail = "Detail 1", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 3", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 4", Detail = "Detail 2", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 5", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ new ImageCell { Text = "Text 6", Detail = "Detail 3", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ new ImageCell { Text = "Text 7", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 8", Detail = "Detail 4", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 9", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 10", Detail = "Detail 5", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 11", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ new ImageCell { Text = "Text 12", Detail = "Detail 6", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ };
+
+ ImageCell imageCell = null;
+ imageCell = new ImageCell {
+ Text = "not tapped",
+ ImageSource = "oasis.jpg",
+ Command = new Command(()=>{
+ imageCell.Text = "tapped";
+ (imageCell.ImageSource as FileImageSource).File = "crimson.jpg";
+ })
+ };
+ var tableSectionTwo = new TableSection ("Section Two") {
+ new ImageCell { Text = "Text 13", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 14", Detail = "Detail 7", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 15", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 16", Detail = "Detail 8", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 17", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ new ImageCell { Text = "Text 18", Detail = "Detail 9", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ new ImageCell { Text = "Text 19", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 20", Detail = "Detail 10", ImageSource = new FileImageSource { File = "crimson.jpg" } },
+ new ImageCell { Text = "Text 21", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 22", Detail = "Detail 11", ImageSource = new FileImageSource { File = "cover1.jpg" } },
+ new ImageCell { Text = "Text 23", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ new ImageCell { Text = "Text 24", Detail = "Detail 12", ImageSource = new FileImageSource { File = "oasis.jpg" } },
+ imageCell,
+ };
+
+ var root = new TableRoot ("Text Cell table") {
+ tableSection,
+ tableSectionTwo
+ };
+
+ var table = new TableView {
+ Root = root,
+ };
+
+ Content = table;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs
new file mode 100644
index 0000000..5973eba
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ProductCellView : StackLayout
+ {
+ Label _timeLabel;
+ Label _brandLabel;
+ StackLayout _stack;
+ public ProductCellView (string text)
+ {
+ _stack = new StackLayout ();
+ _brandLabel = new Label {Text = "BrandLabel", HorizontalTextAlignment = TextAlignment.Center};
+ _stack.Children.Add (_brandLabel);
+
+
+ var frame = new Frame {
+ Content = _stack,
+ BackgroundColor = Device.OnPlatform (iOS: new Color (1), Android: new Color (0.2), WinPhone: new Color (0.2))
+ };
+ _timeLabel = new Label {
+ Text = text
+ };
+ Children.Add (_timeLabel);
+ Children.Add (frame);
+ Padding = new Size (20, 20);
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs
new file mode 100644
index 0000000..c250233
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs
@@ -0,0 +1,47 @@
+using System.Linq;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class SwitchCellItem
+ {
+ public string Label { get; set; }
+ public bool SwitchOn { get; set; }
+ }
+
+ public class SwitchCellListPage : ContentPage
+ {
+ public SwitchCellListPage ()
+ {
+ Title = "SwitchCell List Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var dataTemplate = new DataTemplate (typeof (SwitchCell)) {
+ Bindings = {
+ {SwitchCell.TextProperty, new Binding ("Label")},
+ {SwitchCell.OnProperty, new Binding ("SwitchOn")},
+ }
+ };
+
+ var label = new Label { Text = "I have not been selected" };
+
+ var listView = new ListView {
+ ItemsSource = Enumerable.Range (0, 100).Select (i => new SwitchCellItem {
+ Label = "Label " + i,
+ SwitchOn = i % 2 == 0 ? false : true,
+ }),
+ ItemTemplate = dataTemplate
+ };
+
+ listView.ItemSelected += (sender, args) => label.Text = "I was selected.";
+
+ Content = new StackLayout { Children = { label, listView } };
+ }
+
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs
new file mode 100644
index 0000000..a0deb8e
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs
@@ -0,0 +1,65 @@
+namespace Xamarin.Forms.Controls
+{
+ public class SwitchCellTablePage : ContentPage
+ {
+ public SwitchCellTablePage ()
+ {
+ Title = "SwitchCell Table Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var tableSection = new TableSection ("Section One") {
+ new SwitchCell { Text = "text 1", On = true },
+ new SwitchCell { Text = "text 2" },
+ new SwitchCell { Text = "text 3", On = true },
+ new SwitchCell { Text = "text 4", On = false },
+ new SwitchCell { Text = "text 5", On = true },
+ new SwitchCell { Text = "text 6" },
+ new SwitchCell { Text = "text 7", On = true },
+ new SwitchCell { Text = "text 8", On = false },
+ new SwitchCell { Text = "text 9", On = true },
+ new SwitchCell { Text = "text 10" },
+ new SwitchCell { Text = "text 11", On = true },
+ new SwitchCell { Text = "text 12", On = false },
+ new SwitchCell { Text = "text 13", On = true },
+ new SwitchCell { Text = "text 14" },
+ new SwitchCell { Text = "text 15", On = true },
+ new SwitchCell { Text = "text 16", On = false },
+ };
+
+ var tableSectionTwo = new TableSection ("Section Two") {
+ new SwitchCell { Text = "text 17", On = true },
+ new SwitchCell { Text = "text 18" },
+ new SwitchCell { Text = "text 19", On = true },
+ new SwitchCell { Text = "text 20", On = false },
+ new SwitchCell { Text = "text 21", On = true },
+ new SwitchCell { Text = "text 22" },
+ new SwitchCell { Text = "text 23", On = true },
+ new SwitchCell { Text = "text 24", On = false },
+ new SwitchCell { Text = "text 25", On = true },
+ new SwitchCell { Text = "text 26" },
+ new SwitchCell { Text = "text 27", On = true },
+ new SwitchCell { Text = "text 28", On = false },
+ new SwitchCell { Text = "text 29", On = true },
+ new SwitchCell { Text = "text 30" },
+ new SwitchCell { Text = "text 31", On = true },
+ new SwitchCell { Text = "text 32", On = false },
+ };
+
+ var root = new TableRoot ("Text Cell table") {
+ tableSection,
+ tableSectionTwo
+ };
+
+ var table = new TableView {
+ Root = root,
+ };
+
+ Content = table;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs
new file mode 100644
index 0000000..fbd5e26
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs
@@ -0,0 +1,48 @@
+using System.Linq;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class TextCellTest {
+ public object Text { get; set; }
+ public object TextColor { get; set; }
+ public object Detail { get; set; }
+ public object DetailColor { get; set; }
+ }
+
+ public class TextCellListPage : ContentPage
+ {
+ public TextCellListPage ()
+ {
+ Title = "TextCell List Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var label = new Label { Text = "Not Selected" };
+
+ var dataTemplate = new DataTemplate (typeof (TextCell));
+ dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text"));
+ dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor"));
+ dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail"));
+ dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor"));
+
+ var listView = new ListView {
+ ItemsSource = Enumerable.Range (0, 100).Select (i => new TextCellTest {
+ Text = "Text " + i,
+ TextColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Detail = "Detail " + i,
+ DetailColor = i % 2 == 0 ? Color.Red : Color.Blue
+ }),
+ ItemTemplate = dataTemplate
+ };
+
+ listView.ItemSelected += (sender, args) => { label.Text = "I was selected"; };
+
+ Content = new StackLayout { Children = { label, listView } };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs
new file mode 100644
index 0000000..b9cc0cf
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs
@@ -0,0 +1,58 @@
+namespace Xamarin.Forms.Controls
+{
+ public class TextCellTablePage : ContentPage
+ {
+
+ public TextCellTablePage ()
+ {
+ Title = "TextCell Table Gallery - Legacy";
+
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var tableSection = new TableSection ("Section One") {
+ new TextCell { Text = "Text 1" },
+ new TextCell { Text = "Text 2", Detail = "Detail 1" },
+ new TextCell { Text = "Text 3" },
+ new TextCell { Text = "Text 4", Detail = "Detail 2" },
+ new TextCell { Text = "Text 5" },
+ new TextCell { Text = "Text 6", Detail = "Detail 3" },
+ new TextCell { Text = "Text 7" },
+ new TextCell { Text = "Text 8", Detail = "Detail 4" },
+ new TextCell { Text = "Text 9" },
+ new TextCell { Text = "Text 10", Detail = "Detail 5" },
+ new TextCell { Text = "Text 11" },
+ new TextCell { Text = "Text 12", Detail = "Detail 6" }
+ };
+
+ var tableSectionTwo = new TableSection ("Section Two") {
+ new TextCell { Text = "Text 13" },
+ new TextCell { Text = "Text 14", Detail = "Detail 7" },
+ new TextCell { Text = "Text 15" },
+ new TextCell { Text = "Text 16", Detail = "Detail 8" },
+ new TextCell { Text = "Text 17" },
+ new TextCell { Text = "Text 18", Detail = "Detail 9" },
+ new TextCell { Text = "Text 19" },
+ new TextCell { Text = "Text 20", Detail = "Detail 10" },
+ new TextCell { Text = "Text 21" },
+ new TextCell { Text = "Text 22", Detail = "Detail 11" },
+ new TextCell { Text = "Text 23" },
+ new TextCell { Text = "Text 24", Detail = "Detail 12" }
+ };
+
+ var root = new TableRoot ("Text Cell table") {
+ tableSection,
+ tableSectionTwo
+ };
+
+ var table = new TableView {
+ Root = root,
+ };
+
+ Content = table;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs
new file mode 100644
index 0000000..00c2980
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class UnevenViewCellGallery : ContentPage
+ {
+ public UnevenViewCellGallery ()
+ {
+ Title = "UnevenViewCell Gallery - Legacy";
+
+ var map = MapGallery.MakeMap ();
+ map.HasScrollEnabled = false;
+
+ Content = new TableView {
+ RowHeight = 150,
+ HasUnevenRows = true,
+ Root = new TableRoot {
+ new TableSection ("Testing") {
+ new ViewCell {View = map, Height = 250},
+ new ViewCell {View = new ProductCellView ("1 day")},
+ new ViewCell {View = new ProductCellView ("2 days")},
+ new ViewCell {View = new ProductCellView ("3 days")},
+ new ViewCell {View = new ProductCellView ("4 days")},
+ new ViewCell {View = new ProductCellView ("5 days")}
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs
new file mode 100644
index 0000000..099a786
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs
@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ViewCellGallery : ContentPage
+ {
+ public ViewCellGallery ()
+ {
+ Title = "ViewCell Gallery - Legacy";
+
+ Content = new TableView {
+ RowHeight = 150,
+ Root = new TableRoot {
+ new TableSection ("Testing") {
+ new ViewCell {View = new ProductCellView ("0")},
+ new ViewCell {View = new ProductCellView ("1")},
+ new ViewCell {View = new ProductCellView ("2")},
+ new ViewCell {View = new ProductCellView ("3")},
+ new ViewCell {View = new ProductCellView ("4")}
+ }
+ }
+ };
+ }
+ }
+
+ public class UrlImageViewCellListPage : ContentPage
+ {
+ public UrlImageViewCellListPage()
+ {
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var stringToImageSourceConverter = new GenericValueConverter (
+ obj => new UriImageSource() {
+ Uri = new Uri ((string) obj)
+ });
+
+ var dataTemplate = new DataTemplate (() => {
+ var cell = new ViewCell();
+
+ var image = new Image();
+ image.SetBinding (Image.SourceProperty, new Binding ("Image", converter: stringToImageSourceConverter));
+ image.WidthRequest = 160;
+ image.HeightRequest = 160;
+
+ var text = new Label();
+ text.SetBinding (Label.TextProperty, new Binding ("Text"));
+ text.SetBinding (Label.TextColorProperty, new Binding ("TextColor"));
+
+ cell.View = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ image,
+ text
+ }
+ };
+
+ return cell;
+ });
+
+ var albums = new[] {
+ "https://evolve.xamarin.com/images/sessions/joseph-mayo-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/jon-skeet-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/rachel-reese-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/mike-james-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/daniel-cazzulino-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/michael-hutchinson-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/laurent-bugnion-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/craig-dunn-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/charles-petzold-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/jason-smith-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/frank-krueger-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/james-clancey-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/daniel-plaisted-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/jesse-liberty-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/miguel-de-icaza-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/rene-ruppert-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/brent-schooley-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/adrian-stevens-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/rodrigo-kumpera-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/alex-corrado-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/jonathan-pryor-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/michael-stonis-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/jeremie-laval-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/james-montemagno-icon.jpg",
+ "https://evolve.xamarin.com/images/sessions/brett-duncavage-icon.jpg"
+ };
+
+ var label = new Label { Text = "I have not been selected" };
+
+ var listView = new ListView {
+ ItemsSource = Enumerable.Range (0, albums.Length).Select (i => new {
+ Text = "Text " + i,
+ TextColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Detail = "Detail " + i,
+ DetailColor = i % 2 == 0 ? Color.Red : Color.Blue,
+ Image = albums[i]
+ }),
+ ItemTemplate = dataTemplate
+ };
+
+ listView.ItemSelected += (sender, args) => label.Text = "I was selected";
+
+ Content = new StackLayout { Children = { label, listView } };
+
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs
new file mode 100644
index 0000000..b7cdd8f
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ClipToBoundsGallery : ContentPage
+ {
+ public ClipToBoundsGallery ()
+ {
+ var child1 = new BoxView { Color = Color.Red };
+ var child2 = new BoxView { Color = Color.Blue };
+ var button = new Button { Text = "Clip", BackgroundColor = Color.Green };
+
+ Padding = new Thickness (55);
+ var layout = new AbsoluteLayout {
+ Children = {
+ {child1, new Rectangle (-50, 0, 100, 100)},
+ {child2, new Rectangle (0, -50, 100, 100)},
+ {button, new Rectangle (1.0, 0.5, 100, 100), AbsoluteLayoutFlags.PositionProportional}
+ }
+ };
+
+ button.Clicked += (sender, args) => layout.IsClippedToBounds = !layout.IsClippedToBounds;
+
+ Content = layout;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ControlTemplatePage.cs b/Xamarin.Forms.Controls/GalleryPages/ControlTemplatePage.cs
new file mode 100644
index 0000000..32eb2a1
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ControlTemplatePage.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls.GalleryPages
+{
+ internal class ControlTemplatePage : ContentPage
+ {
+ [Preserve (AllMembers = true)]
+ class MyLayout : StackLayout
+ {
+ public MyLayout ()
+ {
+ Children.Add (new Label {Text = "Before"});
+ Children.Add (new ContentPresenter ());
+ Children.Add (new Label {Text = "After"});
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ class MyOtherLayout : StackLayout
+ {
+ public MyOtherLayout ()
+ {
+ Children.Add (new Entry {Text = "Before"});
+ Children.Add (new ContentPresenter ());
+ Children.Add (new Entry {Text = "After"});
+ }
+ }
+
+ public ControlTemplatePage ()
+ {
+ var button = new Button { Text = "Replace Template" };
+ var content = new ContentView {
+ Content = button,
+ ControlTemplate = new ControlTemplate (typeof (MyLayout))
+ };
+
+ button.Clicked += (sender, args) => {
+ content.ControlTemplate = new ControlTemplate (typeof (MyOtherLayout));
+ };
+
+ Content = content;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml b/Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml
new file mode 100644
index 0000000..38ad475
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Controls.GalleryPages.ControlTemplateXamlPage">
+ <ContentPage.Resources>
+ <ResourceDictionary>
+ <ControlTemplate x:Key="ViewTemplate">
+ <StackLayout>
+ <Label Text="{TemplateBinding Parent.AboveText}" />
+ <ContentPresenter />
+ <Label Text="Below" />
+ </StackLayout>
+ </ControlTemplate>
+ <Style TargetType="ContentView">
+ <Style.Setters>
+ <Setter Property="ControlTemplate" Value="{StaticResource ViewTemplate}" />
+ </Style.Setters>
+ </Style>
+ </ResourceDictionary>
+ </ContentPage.Resources>
+ <ContentView>
+ <Label Text="I R CONTENT" />
+ </ContentView>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml.cs b/Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml.cs
new file mode 100644
index 0000000..b329ea1
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ControlTemplateXamlPage.xaml.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls.GalleryPages
+{
+ public partial class ControlTemplateXamlPage : ContentPage
+ {
+ public static readonly BindableProperty AboveTextProperty =
+ BindableProperty.Create (nameof (AboveText), typeof (string), typeof (ControlTemplateXamlPage), null);
+
+ public string AboveText
+ {
+ get { return (string)GetValue (AboveTextProperty); }
+ set { SetValue (AboveTextProperty, value); }
+ }
+
+ public ControlTemplateXamlPage ()
+ {
+ BindingContext = new {
+ Text = "Testing 123"
+ };
+ this.SetBinding (AboveTextProperty, "Text");
+ InitializeComponent ();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/DisposeGallery.cs b/Xamarin.Forms.Controls/GalleryPages/DisposeGallery.cs
new file mode 100644
index 0000000..910c1af
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/DisposeGallery.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class DisposeGallery : ContentPage
+ {
+ public DisposeGallery ()
+ {
+ var disposePage = new DisposePage ();
+
+ var pushButton = new Button {Text = "Push disposable page"};
+ var pushModalButton = new Button {Text = "PushModal disposable page"};
+
+ pushButton.Clicked += (sender, args) => {
+ disposePage.PopAction = () => Navigation.PopAsync ();
+ Navigation.PushAsync (disposePage);
+ };
+ pushModalButton.Clicked += (sender, args) => {
+ disposePage.PopAction = () => Navigation.PopModalAsync ();
+ Navigation.PushModalAsync (disposePage);
+ };
+
+ var appearingLabel = new Label {Text = "Appearing not sent"};
+ var disappearingLabel = new Label {Text = "Disappearing not sent"};
+
+ var disposedPageLabel = new Label {Text = "Page renderer not yet disposed"};
+ var disposedLabelsLabel = new Label {Text = "Number of disposed labels: 0"};
+
+ disposePage.Appearing += (sender, args) => appearingLabel.Text = "Appearing sent";
+ disposePage.Disappearing += (sender, args) => disappearingLabel.Text = "Disappearing sent";
+ disposePage.RendererDisposed += (sender, args) => {
+ disposedPageLabel.Text = "Page renderer disposed";
+ // give some time for this to propogate
+ Device.StartTimer (TimeSpan.FromSeconds (1), () => {
+ disposedLabelsLabel.Text = "Number of disposed labels: " + disposePage.DisposedLabelCount;
+ return false;
+ });
+
+ };
+
+ Content = new StackLayout {
+ Padding = new Thickness (20),
+ Children = {
+ pushButton,
+ pushModalButton,
+ appearingLabel,
+ disappearingLabel,
+ disposedLabelsLabel,
+ disposedPageLabel
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/EditableList.cs b/Xamarin.Forms.Controls/GalleryPages/EditableList.cs
new file mode 100644
index 0000000..2a7b1a8
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/EditableList.cs
@@ -0,0 +1,116 @@
+using System.Collections.ObjectModel;
+using System.Windows.Input;
+using System.Linq;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class MessagesViewModel : ViewModelBase
+ {
+ public MessagesViewModel()
+ {
+ Messages = new ObservableCollection<MessageViewModel> (Enumerable.Range (0, 100).Select (i => {
+ return new MessageViewModel { Subject = "Subject Line " + i, MessagePreview = "Lorem ipsum dolorem monkeys bonkers " + i };
+ }));
+
+ MessagingCenter.Subscribe<MessageViewModel, MessageViewModel> (this, "DeleteMessage", (vm, vm2) => {
+ Messages.Remove (vm);
+ });
+ }
+
+ public ObservableCollection<MessageViewModel> Messages
+ {
+ get;
+ private set;
+ }
+ }
+
+ [Preserve (AllMembers = true)]
+ internal class MessageViewModel : ViewModelBase
+ {
+ public MessageViewModel()
+ {
+ Delete = new Command (() => MessagingCenter.Send (this, "DeleteMessage", this));
+ Move = new Command (() => MessagingCenter.Send (this, "MoveMessage", this));
+ }
+
+ public string Subject
+ {
+ get;
+ set;
+ }
+
+ public string MessagePreview
+ {
+ get;
+ set;
+ }
+
+ public ICommand Delete
+ {
+ get;
+ private set;
+ }
+
+ public ICommand Move
+ {
+ get;
+ private set;
+ }
+ }
+
+ internal class ContextActionsGallery : ContentPage
+ {
+ class MessageCell : TextCell
+ {
+ public MessageCell()
+ {
+ this.SetBinding (TextProperty, "Subject");
+ this.SetBinding (DetailProperty, "MessagePreview");
+
+ var delete = new MenuItem { Text = "Delete", IsDestructive = true };
+ delete.SetBinding (MenuItem.CommandProperty, "Delete");
+
+ var mark = new MenuItem { Text = "Mark", Icon = "calculator.png" };
+ var move = new MenuItem { Text = "Move" };
+
+ //move.Clicked += async (sender, e) => await Navigation.PopAsync();
+
+ ContextActions.Add (mark);
+ ContextActions.Add (delete);
+ ContextActions.Add (move);
+
+ var clear = new MenuItem { Text = "Clear Items" };
+ clear.Clicked += (sender, args) => ContextActions.Clear();
+ ContextActions.Add (clear);
+ }
+ }
+
+ public ContextActionsGallery (bool tableView = false)
+ {
+ BindingContext = new MessagesViewModel();
+
+ View list;
+ if (!tableView) {
+ list = new ListView();
+ list.SetBinding (ListView.ItemsSourceProperty, "Messages");
+ ((ListView)list).ItemTemplate = new DataTemplate (typeof (MessageCell));
+ } else {
+ var section = new TableSection();
+ section.Add (new TextCell { Text = "I have no ContextActions", Detail = "Sup" });
+ foreach (var msg in ((MessagesViewModel) BindingContext).Messages) {
+ section.Add (new MessageCell { BindingContext = msg });
+ }
+
+ list = new TableView();
+ ((TableView)list).Root = new TableRoot { section };
+ }
+
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Email" },
+ list
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/EditorGallery.cs b/Xamarin.Forms.Controls/GalleryPages/EditorGallery.cs
new file mode 100644
index 0000000..fde0323
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/EditorGallery.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class EditorGallery : ContentPage
+ {
+ public EditorGallery ()
+ {
+ var cellTemplate = new DataTemplate (typeof (TextCell));
+ cellTemplate.SetBinding (TextCell.TextProperty, new Binding ("Title"));
+
+ var list = new ListView {
+ ItemsSource = new ContentPage [] {
+ new EditorGalleryPage ("Default Keyboard", Keyboard.Default),
+ new EditorGalleryPage ("Chat Keyboard", Keyboard.Chat),
+ new EditorGalleryPage ("Text Keyboard", Keyboard.Text),
+ new EditorGalleryPage ("Url Keyboard", Keyboard.Url),
+ new EditorGalleryPage ("Numeric Keyboard", Keyboard.Numeric),
+ new EditableEditorPage ("Enabled", true),
+ new EditableEditorPage ("Disabled", false),
+
+ },
+ ItemTemplate = cellTemplate
+ };
+
+ list.ItemSelected += (sender, arg) => {
+ if (list.SelectedItem != null) {
+ Navigation.PushAsync ((ContentPage)list.SelectedItem);
+ list.SelectedItem = null;
+ }
+ };
+
+ Content = list;
+ }
+ }
+
+ internal class EditableEditorPage : ContentPage
+ {
+ public EditableEditorPage (string title, bool enabled)
+ {
+ Title = "Editable " + enabled.ToString ();
+ Padding = new Thickness (20);
+ var editor = new Editor {
+ Text = Title,
+ IsEnabled = enabled,
+ HeightRequest = 75,
+ };
+
+ var disableButton = new Button {
+ Text = "Disable Editor",
+ };
+
+ var enableButton = new Button {
+ Text = "Enable Editor",
+ };
+
+ disableButton.Clicked += (object sender, EventArgs e) => {
+ editor.IsEnabled = false;
+ };
+
+ enableButton.Clicked += (object sender, EventArgs e) => {
+ editor.IsEnabled = true;
+ };
+
+ Content = new StackLayout {
+ Children = { editor, disableButton, enableButton, }
+ };
+ }
+ }
+
+ public class EditorGalleryPage : ContentPage
+ {
+ public EditorGalleryPage (string title, Keyboard keyboard)
+ {
+ Title = title;
+ BackgroundColor = Color.Red;
+ Padding = new Thickness (20);
+
+ var label = new Label {
+ Text = "Nothing entered"
+ };
+
+ var label2 = new Label {
+ Text = ""
+ };
+
+ var editor = new Editor {
+ HeightRequest = 75,
+ Keyboard = keyboard,
+ Text = "PlaceHolder",
+ };
+
+ editor.Completed += (sender, e) => {
+ label.Text = "Entered : " + editor.Text;
+ };
+
+ editor.TextChanged += (sender, e) => {
+ label2.Text += "x";
+ };
+
+ var unfocus = new Button {
+ Text = "Unfocus",
+ };
+
+ var focus = new Button {
+ Text = "Focus",
+ };
+
+ unfocus.Clicked += (sender, e) => {
+ editor.Unfocus();
+ };
+
+ focus.Clicked += (sender, e) => {
+ editor.Focus();
+ };
+
+ Content = new StackLayout {
+ Children = {
+ label,
+ label2,
+ editor,
+ focus,
+ unfocus,
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/EntryGallery.cs b/Xamarin.Forms.Controls/GalleryPages/EntryGallery.cs
new file mode 100644
index 0000000..5fcf7b8
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/EntryGallery.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class EntryGallery : ContentPage
+ {
+ public EntryGallery ()
+ {
+ var label = new Label { Text = "Enter something in Normal" };
+ var label2 = new Label { Text = "No typing has happened in Normal yet" };
+ var normal = new Entry { Placeholder = "Normal" };
+ var password = new Entry { Placeholder = "Password" };
+ var numericPassword = new Entry { Placeholder = "Numeric Password" };
+ var activation = new Entry { Placeholder = "Activation" };
+ var disabled = new Entry { Placeholder = "Disabled" };
+ var transparent = new Entry { Placeholder = "Transparent" };
+
+ var isFocusedlabel = new Label {
+ Text = "Focus an Entry"
+ };
+
+ var changeKeyboardType = new Entry {
+ Placeholder = "Keyboard.Default",
+ Keyboard = Keyboard.Default
+ };
+
+ changeKeyboardType.Completed += (sender, e) => {
+ changeKeyboardType.Placeholder = "Keyboard.Numeric";
+ changeKeyboardType.Keyboard = Keyboard.Numeric;
+ };
+
+ normal.TextChanged += (s, e) => label2.Text = "You typed in normal";
+
+ normal.Focused += (s, e) => isFocusedlabel.Text = "Normal Focused";
+ normal.Completed += (s, e) => { label.Text = normal.Text; };
+ password.Focused += (s, e) => isFocusedlabel.Text = "Password Focused";
+ numericPassword.Focused += (s, e) => isFocusedlabel.Text = "Numeric Password Focused";
+ activation.Focused += (s, e) => isFocusedlabel.Text = "Activation Focused";
+ disabled.Focused += (s, e) => isFocusedlabel.Text = "Disabled Focused";
+ transparent.Focused += (s, e) => isFocusedlabel.Text = "Transparent Focused";
+ changeKeyboardType.Focused += (s, e) => isFocusedlabel.Text = "Keyboard.Default Focused";
+
+ var toggleColorButton = new Button { Text = "Toggle Text Color" };
+ var changeSecureButton = new Button { Text = "Toggle Secure" };
+ var changePlaceholderButton = new Button { Text = "Change Placeholder" };
+ var focusNormalButton = new Button { Text = "Focus First" };
+
+ transparent.Opacity = 0.5;
+ password.IsPassword = true;
+ numericPassword.IsPassword = true;
+ numericPassword.Keyboard = Keyboard.Numeric;
+ activation.Completed += (sender, e) => activation.Text = "Activated";
+ disabled.IsEnabled = false;
+
+ toggleColorButton.Clicked += (sender, e) => {
+ if (normal.TextColor == Color.Default) {
+ normal.TextColor = Color.Red;
+ password.TextColor = Color.Red;
+ numericPassword.TextColor = Color.Red;
+ } else {
+ normal.TextColor = Color.Default;
+ password.TextColor = Color.Default;
+ numericPassword.TextColor = Color.Default;
+ }
+ };
+
+ changeSecureButton.Clicked += (sender, e) => {
+ password.IsPassword = !password.IsPassword;
+ numericPassword.IsPassword = !numericPassword.IsPassword;
+ };
+
+ int i = 1;
+ changePlaceholderButton.Clicked += (sender, e) => { normal.Placeholder = "Placeholder " + i++.ToString (); };
+
+ focusNormalButton.Clicked += (sender, args) => normal.Focus ();
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Padding = new Thickness (80),
+ Children = {
+ label,
+ label2,
+ normal,
+ password,
+ numericPassword,
+ disabled,
+ isFocusedlabel,
+ activation,
+ transparent,
+ changeKeyboardType,
+ toggleColorButton,
+ changeSecureButton,
+ changePlaceholderButton,
+ focusNormalButton,
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs b/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs
new file mode 100644
index 0000000..ee7c182
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class FrameGallery : ContentPage
+ {
+ readonly StackLayout _stack;
+
+ public FrameGallery ()
+ {
+ Content = _stack = new StackLayout { Padding = new Size (20, 20) };
+
+ //BackgroundColor = new Color (0.5, 0.5, 0.5);
+ BackgroundColor = Color.FromHex ("#8a2be2");
+ //BackgroundColor = Color.Aqua;
+
+ var frame = new Frame {
+ Content = new Button {
+ Text = "Framous!"
+ },
+ BackgroundColor = Device.OnPlatform (iOS: new Color (1), Android: new Color (0), WinPhone: new Color (0)),
+ VerticalOptions = LayoutOptions.FillAndExpand
+ };
+
+ _stack.Children.Add (frame);
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/GridGallery.cs b/Xamarin.Forms.Controls/GalleryPages/GridGallery.cs
new file mode 100644
index 0000000..d786a81
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/GridGallery.cs
@@ -0,0 +1,174 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+
+ public class GridGallery : ContentPage
+ {
+ public GridGallery ()
+ {
+ var layout = new StackLayout {
+ Orientation = StackOrientation.Vertical
+ };
+
+ //ColumnTypes
+ layout.Children.Add (new Label { Text = "Column Types:" });
+ var grid = new Grid {
+ ColumnDefinitions = {
+ new ColumnDefinition { Width = 80 },
+ new ColumnDefinition (),
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }
+ },
+ BackgroundColor = Color.FromRgb (0xee, 0xee, 0xee)
+ };
+
+ grid.Children.Add (new Label {
+ Text = "Absolute Width",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, 0, 0);
+ grid.Children.Add (new Label {
+ Text = "Auto Width",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, 1, 0);
+ grid.Children.Add (new Label {
+ Text = "Star",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, 2, 0);
+ layout.Children.Add (grid);
+
+ //Star
+ layout.Children.Add (new Label { Text = "Star Columns:" });
+ grid = new Grid {
+ ColumnDefinitions = {
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
+ },
+ BackgroundColor = Color.FromRgb (0xee, 0xee, 0xee),
+ ColumnSpacing = 0,
+ RowSpacing = 0,
+ };
+
+ grid.Children.Add (new Label {
+ Text = "*",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, 0, 0);
+ grid.Children.Add (new Label {
+ Text = "**",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, 1, 0);
+ grid.Children.Add (new Label {
+ Text = "***",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, 2, 0);
+ layout.Children.Add (grid);
+
+ //Alignment
+ layout.Children.Add (new Label { Text = "Alignment:" });
+ grid = new Grid {
+ ColumnDefinitions = {
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ },
+ BackgroundColor = Color.FromRgb (0xee, 0xee, 0xee)
+ };
+
+ grid.Children.Add (new Label {
+ Text = "Right",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ HorizontalOptions = LayoutOptions.End,
+ }, 0, 0);
+ grid.Children.Add (new Label {
+ Text = "Center",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ HorizontalOptions = LayoutOptions.Center,
+
+ }, 1, 0);
+ grid.Children.Add (new Label {
+ Text = "Left",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ HorizontalOptions = LayoutOptions.Start,
+ }, 2, 0);
+ grid.Children.Add (new Label {
+ Text = "Fill",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ HorizontalOptions = LayoutOptions.Fill,
+ }, 3, 0);
+ layout.Children.Add (grid);
+
+ //Spanning
+ layout.Children.Add (new Label { Text = "Spans:" });
+ grid = new Grid {
+ ColumnDefinitions = {
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ },
+ BackgroundColor = Color.FromRgb (0xee, 0xee, 0xee),
+ ColumnSpacing = 0,
+ RowSpacing = 0
+ };
+
+ for (var i=0;i<5;i++)
+ for (var j=0;j<5;j++)
+ grid.Children.Add (new Label {
+ Text = "Unit",
+ BackgroundColor = Color.FromRgb (0xcc, 0xcc, 0xcc),
+ }, i, j);
+
+
+ grid.Children.Add (new Label {
+ Text = "Spanning 4 columns",
+ BackgroundColor = Color.Red,
+ }, 0,4,0,1);
+ grid.Children.Add (new Label {
+ Text = "Spanning 3 rows",
+ BackgroundColor = Color.Gray,
+ }, 4,5, 0,3);
+ grid.Children.Add (new Label {
+ Text = "a block 3x3",
+ BackgroundColor = Color.Green,
+ }, 1,4,1,4);
+ layout.Children.Add (grid);
+
+
+ //Change Width
+ var col0 = new ColumnDefinition { Width = 40 };
+ var col1 = new ColumnDefinition { Width = 80 };
+
+ grid = new Grid {
+ ColumnDefinitions = new ColumnDefinitionCollection {
+ col0, col1
+ }
+ };
+
+ grid.Children.Add (new BoxView { BackgroundColor = Color.Red });
+ grid.Children.Add (new BoxView { BackgroundColor = Color.Blue },1,0);
+
+ layout.Children.Add (grid);
+ layout.Children.Add (new Button {
+ Text = "ChangeWidth",
+ Command = new Command (()=>{
+ var t = col0.Width;
+ col0.Width = col1.Width;
+ col1.Width = t;
+ })
+ });
+
+ Content = new ScrollView {
+ Content = layout,
+ };
+
+
+
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/GroupedListActionsGallery.cs b/Xamarin.Forms.Controls/GalleryPages/GroupedListActionsGallery.cs
new file mode 100644
index 0000000..3d8b85c
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/GroupedListActionsGallery.cs
@@ -0,0 +1,282 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class GroupedListActionsGallery
+ : ContentPage
+ {
+ class Group
+ : ObservableList<GroupAction>, INotifyPropertyChanged
+ {
+ public Group (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ Name = name;
+ ShortName = Name[0].ToString();
+ }
+
+ string _name;
+ string _shortName;
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public string Name
+ {
+ get { return _name; }
+ set
+ {
+ if (_name == value)
+ return;
+
+ _name = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public string ShortName
+ {
+ get { return _shortName; }
+ set
+ {
+ if (_shortName == value)
+ return;
+
+ _shortName = value;
+ OnPropertyChanged();
+ }
+ }
+
+ protected override void InsertItem (int index, GroupAction item)
+ {
+ item.Parent = this;
+ base.InsertItem (index, item);
+ }
+
+ void OnPropertyChanged ([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null)
+ handler (this, new PropertyChangedEventArgs (propertyName));
+ }
+ }
+
+ class GroupAction
+ {
+ readonly Action<GroupAction> _action;
+
+ public GroupAction (string name, Action<GroupAction> action = null)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ Name = name;
+ _action = action;
+ }
+
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ public void DoStuff()
+ {
+ if (_action == null)
+ return;
+
+ _action (this);
+ }
+
+ public Group Parent
+ {
+ get;
+ set;
+ }
+ }
+
+ readonly ListView _list = new ListView {
+ IsGroupingEnabled = true,
+ GroupHeaderTemplate = new DataTemplate(() => {
+ var label = new Label {
+ VerticalOptions = LayoutOptions.CenterAndExpand,
+ TextColor = Color.Red
+ };
+
+ label.SetBinding (Label.TextProperty, "Name");
+
+ return new ViewCell {
+ View = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ new Image {
+ Source = ImageSource.FromFile ("cover1.jpg"),
+ HeightRequest = 20,
+ WidthRequest = 20
+ },
+
+ label,
+ }
+ }
+ };
+ }),
+
+ ItemTemplate = new DataTemplate (() => {
+ var c = new TextCell();
+ c.SetBinding (TextCell.TextProperty, "Name");
+ return c;
+ })
+ };
+
+ readonly ObservableList<Group> _groups;
+
+ ObservableList<Group> CreateItemSource()
+ {
+ return new ObservableList<Group> {
+ new Group ("General") {
+ new GroupAction ("Change group name", ga => ga.Parent.Name += " (changed)"),
+ new GroupAction ("Change group short name", ga => ga.Parent.ShortName = ga.Parent.Name[1].ToString())
+ },
+
+ new Group ("Child item actions") {
+ new GroupAction ("Clear this group", ga => ga.Parent.Clear()),
+ new GroupAction ("Insert group item", ga => ga.Parent.Insert (1, new GroupAction ("Inserted item S"))),
+ new GroupAction ("Insert 2 group items", ga => ga.Parent.InsertRange (1, GetGroupActions ("Inserted item D", 2))),
+ new GroupAction ("Remove next item", ga => ga.Parent.Remove (ga.Parent[GetIndexOfDummy (ga)])),
+ new GroupAction ("Dummy item RDI"),
+ new GroupAction ("Remove next 2 dummy items", ga => ga.Parent.RemoveRange (GetNextDummyItems (ga, 2))),
+ new GroupAction ("Dummy item RmDI-1"),
+ new GroupAction ("Dummy item RmDI-2"),
+ new GroupAction ("Replace dummy item", ga => ga.Parent[GetIndexOfDummy(ga)] = new GroupAction ("Replaced item")),
+ new GroupAction ("Dummy item RpDI"),
+ new GroupAction ("Replace next two dummy items", ga =>
+ ga.Parent.ReplaceRange (GetIndexOfDummy (ga, 2), GetGroupActions ("Replaced items", 2))),
+ new GroupAction ("Dummy item RpDI-1"),
+ new GroupAction ("Dummy item RpDI-2"),
+ new GroupAction ("Select next dummy item", ga => {
+ int index = GetIndexOfDummy (ga);
+ _list.SelectedItem = ga.Parent[index];
+ }),
+ new GroupAction ("Dummy item SI"),
+ new GroupAction ("Move dummy above this one", ga => {
+ int nindex = GetIndexOfDummy (ga);
+ ga.Parent.Move (nindex, ga.Parent.IndexOf (c => c.Name.StartsWith ("Move dummy")));
+ }),
+ new GroupAction ("Dummy item MDI"),
+ new GroupAction ("Move last 2 items above this one", ga => {
+ int nindex = GetIndexOfDummy (ga, 2);
+ ga.Parent.Move (nindex, ga.Parent.IndexOf (c => c.Name.StartsWith ("Move last 2")), 2);
+ }),
+ new GroupAction ("Dummy item M2DI-1"),
+ new GroupAction ("Dummy item M2DI-2"),
+ },
+
+ CreateDummyGroup (2),
+ CreateDummyGroup (2),
+
+ new Group ("Group item actions") {
+ new GroupAction ("Clear all", ga => _groups.Clear()),
+ new GroupAction ("Insert group", ga => {
+ int index = _groups.IndexOf (g => g.Name == "Group item actions");
+ _groups.Insert (index, CreateDummyGroup (2));
+ }),
+
+ new GroupAction ("Insert 2 groups", ga => {
+ int index = _groups.IndexOf (g => g.Name == "Group item actions");
+ _groups.InsertRange (index, new[] { CreateDummyGroup (2), CreateDummyGroup (2) });
+ }),
+
+ new GroupAction ("Remove previous dummy group", ga => {
+ int index = _groups.IndexOf (g => g.Name == "Group item actions");
+ var dg = _groups.Take (index).Last (g => g.Name == "Dummy group");
+ _groups.Remove (dg);
+ }),
+
+ new GroupAction ("Remove previous 2 dummy groups", ga => {
+ int index = _groups.IndexOf (g => g.Name == "Group item actions");
+ var dgs = _groups.Take (index).Reverse().Where (g => g.Name == "Dummy group").Take (2);
+ _groups.RemoveRange (dgs);
+ }),
+
+ new GroupAction ("Replace previous dummy group", ga => {
+ int index = _groups.IndexOf (g => g.Name == "Group item actions");
+ var dg = _groups.Take (index).Last (g => g.Name == "Dummy group");
+ _groups[_groups.IndexOf (dg)] = new Group ("Replaced group") {
+ new GroupAction ("Replaced group item")
+ };
+ }),
+
+ new GroupAction ("Replace previous 2 dummy groups", ga => {
+ int index = _groups.IndexOf (g => g.Name == "Group item actions");
+ var dgs = _groups.Take (index).Reverse().Where (g => g.Name == "Dummy group").Take (2).Reverse();
+ _groups.ReplaceRange (_groups.IndexOf (dgs.First()), new[] {
+ new Group ("Replaced group") {
+ new GroupAction ("Replaced group item")
+ },
+ new Group ("Replaced group") {
+ new GroupAction ("Replaced group item")
+ }
+ });
+ }),
+
+ new GroupAction ("Move next group above", ga => {
+ int index = _groups.IndexOf (g => g.Name == ga.Parent.Name);
+ int dgindex = _groups.IndexOf (_groups.Skip (index + 1).First (dg => dg.Name == "Dummy group"));
+ _groups.Move (dgindex, index);
+ }),
+
+ new GroupAction ("Move next 2 groups above", ga => {
+ int index = _groups.IndexOf (g => g.Name == ga.Parent.Name);
+ int dgindex = _groups.IndexOf (_groups.Skip (index + 1).First (dg => dg.Name == "Dummy group"));
+ _groups.Move (dgindex, index, 2);
+ }),
+ },
+
+ CreateDummyGroup (1),
+ CreateDummyGroup (1),
+ CreateDummyGroup (1)
+ };
+ }
+
+ public GroupedListActionsGallery()
+ {
+ NavigationPage.SetHasNavigationBar (this, false);
+ _groups = CreateItemSource();
+
+ _list.ItemTapped += (sender, arg) => ((GroupAction)arg.Item).DoStuff();
+
+ _list.ItemsSource = _groups;
+ Title = "Actions";
+ Content = _list;
+ }
+
+ IEnumerable<GroupAction> GetGroupActions (string name, int count)
+ {
+ return Enumerable.Range (0, count).Select (i => new GroupAction (name + " " + i));
+ }
+
+ Group CreateDummyGroup (int children)
+ {
+ var group = new Group ("Dummy group");
+ group.AddRange (Enumerable.Range (0, children).Select (i => new GroupAction ("Dummy item")));
+ return group;
+ }
+
+ int GetIndexOfDummy (GroupAction source, int count = 1)
+ {
+ var dummies = GetNextDummyItems (source, count);
+ return source.Parent.IndexOf (dummies.First());
+ }
+
+ IEnumerable<GroupAction> GetNextDummyItems (GroupAction source, int count)
+ {
+ int start = source.Parent.IndexOf (source);
+ return source.Parent.Skip (start).Where (xga => xga.Name.StartsWith ("Dummy item")).Take (count);
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs b/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs
new file mode 100644
index 0000000..1058b69
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs
@@ -0,0 +1,244 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ public class GroupedListContactsGallery
+ : ContentPage
+ {
+ internal class Contact
+ {
+ public string FirstName
+ {
+ get;
+ set;
+ }
+
+ public string LastName
+ {
+ get;
+ set;
+ }
+
+ public string FullName
+ {
+ get { return FirstName + " " + LastName; }
+ }
+
+ public string Title
+ {
+ get;
+ set;
+ }
+ }
+
+ readonly ListView _list = new ListView {
+ ItemTemplate = new DataTemplate (() => {
+ Label name = new Label();
+ name.SetBinding (Label.TextProperty, "FullName");
+
+ Label title = new Label { Font = Font.SystemFontOfSize (NamedSize.Micro) };
+ title.SetBinding (Label.TextProperty, "Title");
+
+ return new ViewCell { View = new StackLayout {
+ Children = {
+ name,
+ title
+ }
+ } };
+ }),
+
+ GroupDisplayBinding = new Binding ("Key"),
+ GroupShortNameBinding = new Binding ("Key"),
+ IsGroupingEnabled = true
+ };
+
+ readonly List<Contact> _contacts = new List<Contact> {
+ new Contact { FirstName = "Jason", LastName = "Smith", Title = "Software Engineer" },
+ new Contact { FirstName = "Eric", LastName = "Maupin", Title = "Software Engineer" },
+ new Contact { FirstName = "Seth", LastName = "Rosetter", Title = "Software Engineer" },
+ new Contact { FirstName = "Stephane", LastName = "Delcroix", Title = "Software Engineer" }
+ };
+
+ readonly Random _rand = new Random (42);
+
+ [Preserve (AllMembers = true)]
+ internal class Group
+ : ObservableCollection<Contact>
+ {
+ public Group (string key)
+ {
+ Key = key;
+ }
+
+ public string Key
+ {
+ get;
+ private set;
+ }
+ }
+
+ bool _sortedByFirst = true;
+ ObservableCollection<Group> _sortedContacts;
+
+ public GroupedListContactsGallery()
+ {
+ var addRandom = new Button { Text = "Random" };
+ addRandom.Clicked += (sender, args) => {
+ Contact contact = GetRandomContact();
+ _contacts.Add (contact);
+
+ AddContact (_sortedContacts, contact);
+ };
+
+ var addRandomToExisting = new Button { Text = "Random Group" };
+ addRandomToExisting.Clicked += (sender, args) => {
+ Contact contact;
+ do {
+ contact = GetRandomContact();
+ } while (!_sortedContacts.Any (g => GetSortChar (g.First()) == GetSortChar (contact)));
+
+ _contacts.Add (contact);
+ AddContact (_sortedContacts, contact);
+ };
+
+ var groupByFirst = new Button { Text = "First" };
+ groupByFirst.Clicked += (sender, args) => {
+ _sortedByFirst = true;
+
+ SetupContacts();
+ _list.ItemsSource = _sortedContacts;
+ };
+
+ var groupByLast = new Button { Text = "Last" };
+ groupByLast.Clicked += (sender, args) => {
+ _sortedByFirst = false;
+
+ SetupContacts();
+ _list.ItemsSource = _sortedContacts;
+ };
+
+ Content = new StackLayout {
+ Orientation = StackOrientation.Vertical,
+ Children = {
+ new StackLayout {
+ Orientation = StackOrientation.Vertical,
+ Children = {
+ new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ new Label { Text = "Sort: " },
+ groupByFirst,
+ groupByLast
+ }
+ },
+
+ new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ addRandom,
+ addRandomToExisting,
+ }
+ }
+ },
+ },
+
+
+ _list
+ }
+ };
+
+ SetupContacts();
+ _list.ItemsSource = _sortedContacts;
+ }
+
+ const string Chars = "abcdefghijklmnopqrstuvwxyz";
+
+ void SetupContacts()
+ {
+ var coll = new ObservableCollection<Group>();
+ foreach (var contact in _contacts)
+ AddContact (coll, contact);
+
+ _sortedContacts = coll;
+ }
+
+ void AddContact (ObservableCollection<Group> contactGroups, Contact contact)
+ {
+ char sortChar = GetSortChar (contact);
+
+ var collection = contactGroups.FirstOrDefault (col => {
+ var c = col.First();
+ return (GetSortChar (c) == sortChar);
+ });
+
+ if (collection == null) {
+ var ocontacts = new Group (GetSortChar (contact).ToString()) { contact };
+ InsertBasedOnSort (contactGroups, ocontacts, c => GetSortChar (c.First()));
+ } else
+ InsertBasedOnSort (collection, contact, c => GetSortString (c)[0]);
+ }
+
+ int IndexOf<T> (IEnumerable<T> elements, T element)
+ {
+ int i = 0;
+ foreach (T e in elements) {
+ if (Equals (e, element))
+ return i;
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ void InsertBasedOnSort<T,TSort> (IList<T> items, T item, Func<T, TSort> sortBy)
+ {
+ List<T> newItems = new List<T> (items);
+ newItems.Add (item);
+ int index = IndexOf (newItems.OrderBy (sortBy), item);
+ items.Insert (index, item);
+ }
+
+ char GetSortChar (Contact contact)
+ {
+ return GetSortString (contact)[0];
+ }
+
+ string GetSortString (Contact contact)
+ {
+ return (_sortedByFirst) ? contact.FirstName : contact.LastName;
+ }
+
+ Contact GetRandomContact()
+ {
+ Contact contact = new Contact();
+
+ int firstLen = _rand.Next (3, 7);
+
+ var builder = new StringBuilder (firstLen);
+ for (int i = 0; i < firstLen; i++) {
+ char c = Chars[_rand.Next (0, Chars.Length)];
+ builder.Append ((i != 0) ? c : char.ToUpper (c));
+ }
+
+ contact.FirstName = builder.ToString();
+
+ int lastLen = _rand.Next (3, 7);
+ builder.Clear();
+ for (int i = 0; i < lastLen; i++) {
+ char c = Chars[_rand.Next (0, Chars.Length)];
+ builder.Append ((i != 0) ? c : char.ToUpper (c));
+ }
+
+ contact.LastName = builder.ToString();
+ contact.Title = "Software Engineer";
+
+ return contact;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ImageGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ImageGallery.cs
new file mode 100644
index 0000000..9d4a32c
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ImageGallery.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ImageGallery : ContentPage
+ {
+ public ImageGallery ()
+ {
+
+ Padding = new Thickness (20);
+
+ var normal = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
+ var disabled = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
+ var rotate = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
+ var transparent = new Image { Source = ImageSource.FromFile ("cover1.jpg") };
+ var embedded = new Image { Source = ImageSource.FromResource ("Xamarin.Forms.Controls.ControlGalleryPages.crimson.jpg", typeof (ImageGallery)) };
+
+ // let the stack shrink the images
+ normal.MinimumHeightRequest = normal.MinimumHeightRequest = 10;
+ disabled.MinimumHeightRequest = disabled.MinimumHeightRequest = 10;
+ rotate.MinimumHeightRequest = rotate.MinimumHeightRequest = 10;
+ transparent.MinimumHeightRequest = transparent.MinimumHeightRequest = 10;
+ embedded.MinimumHeightRequest = 10;
+
+ disabled.IsEnabled = false;
+ rotate.GestureRecognizers.Add (new TapGestureRecognizer { Command = new Command (o => rotate.RelRotateTo (180))});
+ transparent.Opacity = .5;
+
+ Content = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ new StackLayout {
+ //MinimumWidthRequest = 20,
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ Children = {
+ normal,
+ disabled,
+ transparent,
+ rotate,
+ embedded,
+ new StackLayout {
+ HeightRequest = 30,
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ new Image {Source = "cover1.jpg"},
+ new Image {Source = "cover1.jpg"},
+ new Image {Source = "cover1.jpg"},
+ new Image {Source = "cover1.jpg"}
+ }
+ }
+ }
+ },
+ new StackLayout {
+ WidthRequest = 30,
+ Children = {
+ new Image {Source = "cover1.jpg"},
+ new Image {Source = "cover1.jpg"},
+ new Image {Source = "cover1.jpg"},
+ new Image {Source = "cover1.jpg"}
+ }
+ }
+
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ImageLoadingGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ImageLoadingGallery.cs
new file mode 100644
index 0000000..f916d7d
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ImageLoadingGallery.cs
@@ -0,0 +1,43 @@
+using System;
+using System.ComponentModel;
+
+namespace Xamarin.Forms.Controls
+{
+
+ public class ImageLoadingGallery : ContentPage
+ {
+ public ImageLoadingGallery ()
+ {
+ Padding = new Thickness (20);
+
+ var source = new UriImageSource {
+ Uri = new Uri ("http://www.nasa.gov/sites/default/files/styles/1600x1200_autoletterbox/public/images/298773main_EC02-0282-3_full.jpg"),
+ CachingEnabled = false
+ };
+
+ var image = new Image {
+ Source = source,
+ WidthRequest = 200,
+ HeightRequest = 200,
+ };
+
+ var indicator = new ActivityIndicator {Color = new Color (.5),};
+ indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading");
+ indicator.BindingContext = image;
+
+ var grid = new Grid();
+ grid.RowDefinitions.Add (new RowDefinition());
+ grid.RowDefinitions.Add (new RowDefinition());
+
+ grid.Children.Add (image);
+ grid.Children.Add (indicator);
+
+ var cancel = new Button { Text = "Cancel" };
+ cancel.Clicked += (s, e) => source.Cancel();
+ Grid.SetRow (cancel, 1);
+ grid.Children.Add (cancel);
+
+ Content = grid;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/InputIntentGallery.cs b/Xamarin.Forms.Controls/GalleryPages/InputIntentGallery.cs
new file mode 100644
index 0000000..0f1461b
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/InputIntentGallery.cs
@@ -0,0 +1,101 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class InputIntentGallery : ContentPage
+ {
+ public InputIntentGallery ()
+ {
+ var label = new Label {
+ Text = "Custom Not Focused"
+ };
+
+ var label2 = new Label {
+ Text = ""
+ };
+
+ var defaultEntry = new Entry {
+ Placeholder = "Default",
+ Keyboard = Keyboard.Default
+ };
+
+ defaultEntry.Completed += (sender, e) => label2.Text = "Default completed";
+
+ var emailEntry = new Entry {
+ Placeholder = "Email Input",
+ Keyboard = Keyboard.Email
+ };
+
+ emailEntry.Completed += (sender, e) => label2.Text = "Email completed";
+
+ var textEntry = new Entry {
+ Placeholder = "Text Input",
+ Keyboard = Keyboard.Text
+ };
+
+ textEntry.Completed += (sender, e) => label2.Text = "Text completed";
+
+ var urlEntry = new Entry {
+ Placeholder = "Url Input",
+ Keyboard = Keyboard.Url
+ };
+
+ urlEntry.Completed += (sender, e) => label2.Text = "URL completed";
+
+ var numericEntry = new Entry {
+ Placeholder = "Numeric Input",
+ Keyboard = Keyboard.Numeric
+ };
+
+ numericEntry.Completed += (sender, e) => label2.Text = "Numeric completed";
+
+ var telephoneEntry = new Entry {
+ Placeholder = "Telephone Input",
+ Keyboard = Keyboard.Telephone
+ };
+
+ telephoneEntry.Completed += (sender, e) => label2.Text = "Telephone completed";
+
+ var chatEntry = new Entry {
+ Placeholder = "Chat Input",
+ Keyboard = Keyboard.Chat
+ };
+
+ chatEntry.Completed += (sender, e) => label2.Text = "Chat completed";
+
+ var customEntry = new Entry {
+ Placeholder = "Custom Entry",
+ Keyboard = Keyboard.Create (KeyboardFlags.CapitalizeSentence)
+ };
+
+ customEntry.Completed += (sender, e) => label2.Text = "Custom completed";
+
+ customEntry.Focused += (s, e) => {
+ label.Text = "Custom Focused";
+ };
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ VerticalOptions = LayoutOptions.Center,
+ Padding = new Thickness (40, 20),
+ Children = {
+ label,
+ label2,
+ defaultEntry,
+ emailEntry,
+ textEntry,
+ urlEntry,
+ numericEntry,
+ telephoneEntry,
+ chatEntry,
+ customEntry
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs b/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs
new file mode 100644
index 0000000..6521096
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs
@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class LabelGallery : ContentPage
+ {
+ public LabelGallery ()
+ {
+ var normal = new Label { Text = "Normal Label" };
+ var center = new Label { Text = "Center Label" };
+ var right = new Label { Text = "Right Label" };
+ var moving = new Label { Text = "Move On Click" };
+ var click = new Label { Text = "Click Label" };
+ var rotate = new Label { Text = "Rotate Label" };
+ var transparent = new Label { Text = "Transparent Label" };
+ var color = new Label { Text = "Color Change" };
+ var micro = new Label { Text = "Micro Label" };
+ var small = new Label { Text = "Small Label" };
+ var medium = new Label { Text = "Medium Label" };
+ var large = new Label { Text = "Large Label", VerticalOptions = LayoutOptions.FillAndExpand, VerticalTextAlignment = TextAlignment.Center};
+ var bold = new Label { Text = "Bold Label" };
+ var italic = new Label { Text = "Italic Label" };
+ var bolditalic = new Label { Text = "Bold Italic Label" };
+ var customFont = new Label { Text = "Custom Font" };
+ var italicfont = new Label { Text = "Custom Italic Font" };
+ var boldfont = new Label { Text = "Custom Bold Font" };
+ var bolditalicfont = new Label { Text = "Custom Bold Italic Font" };
+ var huge = new Label {
+ Text = "This is the label that never ends, yes it go on and on my friend. " +
+ "Some people started catting it not knowing what it was, and they'll continue catting it forever just because...",
+ LineBreakMode = LineBreakMode.WordWrap
+ };
+ var formatted = new Label { FormattedText = new FormattedString {
+ Spans = {
+ new Span {Text="FormattedStrings ", ForegroundColor=Color.Blue, BackgroundColor = Color.Yellow, Font = Font.BoldSystemFontOfSize (NamedSize.Large)},
+ new Span {Text="are ", ForegroundColor=Color.Red, BackgroundColor = Color.Gray},
+ new Span {Text="not pretty!", ForegroundColor = Color.Green,},
+ }
+ } };
+ var missingfont = new Label { Text = "Missing font: use default" };
+
+ micro.Font = Font.SystemFontOfSize (NamedSize.Micro);
+ small.Font = Font.SystemFontOfSize (NamedSize.Small);
+ medium.Font = Font.SystemFontOfSize (NamedSize.Medium);
+ large.Font = Font.SystemFontOfSize (NamedSize.Large);
+
+ bold.Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Bold);
+ italic.Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Italic);
+ bolditalic.Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Bold | FontAttributes.Italic);
+
+ var fontName = Device.OnPlatform ("Georgia", "sans-serif-light", "Comic Sans MS");
+ var font = Font.OfSize (fontName, NamedSize.Medium);
+ customFont.Font = font;
+ italicfont.Font = font.WithAttributes (FontAttributes.Italic);
+ boldfont.Font = font.WithAttributes (FontAttributes.Bold);
+ bolditalicfont.Font = font.WithAttributes (FontAttributes.Bold | FontAttributes.Italic);
+
+ customFont.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o => customFont.Font = Font.Default)});
+
+ missingfont.Font = Font.OfSize ("FooBar", 20);
+ center.HorizontalTextAlignment = TextAlignment.Center;
+ right.HorizontalTextAlignment = TextAlignment.End;
+ int i = 1;
+ click.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o=>click.Text = "Clicked " + i++)});
+ rotate.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o=>rotate.RelRotateTo (180))});
+ transparent.Opacity = .5;
+ moving.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o=>moving.HorizontalTextAlignment = TextAlignment.End)});
+
+ color.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o=>{
+ color.TextColor = new Color (1, 0, 0);
+ color.BackgroundColor = new Color (0, 1, 0);
+ })});
+
+ Thickness padding = new Thickness (20);
+ // Padding Adjust for iPad
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet)
+ padding = new Thickness (20, 20, 20, 60);
+ });
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Padding = padding,
+ Children = {
+ formatted,
+ normal,
+ center,
+ right,
+ huge,
+ moving,
+ click,
+ rotate,
+ transparent,
+ color,
+ micro,
+ small,
+ medium,
+ large,
+ bold,
+ italic,
+ bolditalic,
+ customFont,
+ italicfont,
+ boldfont,
+ bolditalicfont,
+ missingfont,
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/LayoutOptionsGallery.cs b/Xamarin.Forms.Controls/GalleryPages/LayoutOptionsGallery.cs
new file mode 100644
index 0000000..13c6c57
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/LayoutOptionsGallery.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class LayoutOptionsGallery : ContentPage
+ {
+ public LayoutOptionsGallery ()
+ {
+ Build ();
+ }
+
+ void Build ()
+ {
+ var mainLayout = new StackLayout {
+ BackgroundColor = Color.Silver,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ Children = {
+ BuildLayoutRegion (),
+ BuildLayoutRegion ()
+ }
+ };
+
+ var changeOrientationButton = new Button {Text = "Change Orientation"};
+ changeOrientationButton.Clicked += (sender, args) => mainLayout.Orientation = (mainLayout.Orientation == StackOrientation.Horizontal) ? StackOrientation.Vertical : StackOrientation.Horizontal;
+
+ Content = new StackLayout {
+ Children = {
+ changeOrientationButton,
+ mainLayout
+ }
+ };
+ }
+
+ LayoutOptions StringToLayoutOptions (string options)
+ {
+ switch (options) {
+ case "Start":
+ return LayoutOptions.Start;
+ case "StartAndExpand":
+ return LayoutOptions.StartAndExpand;
+ case "Center":
+ return LayoutOptions.Center;
+ case "CenterAndExpand":
+ return LayoutOptions.CenterAndExpand;
+ case "End":
+ return LayoutOptions.End;
+ case "EndAndExpand":
+ return LayoutOptions.EndAndExpand;
+ case "Fill":
+ return LayoutOptions.Fill;
+ case "FillAndExpand":
+ return LayoutOptions.FillAndExpand;
+ }
+ throw new InvalidDataException ();
+ }
+
+ View BuildLayoutRegion ()
+ {
+ // Set these to fill and expand so they just fill their parent which is the thing we actually want to play with.
+ var horizontalButton = new Button {
+ Text = "H Options",
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ };
+
+ var verticalButton = new Button {
+ Text = "V Options",
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ };
+
+ var result = new StackLayout {
+ BackgroundColor = Color.Gray,
+ Children = {
+ horizontalButton,
+ verticalButton
+ }
+ };
+
+ horizontalButton.Clicked += async (sender, args) => {
+ var selection = await DisplayActionSheet ("Select Horizontal Options", null, null,
+ "Start", "StartAndExpand",
+ "Center", "CenterAndExpand",
+ "End", "EndAndExpand",
+ "Fill", "FillAndExpand");
+
+ result.HorizontalOptions = StringToLayoutOptions (selection);
+ };
+
+ verticalButton.Clicked += async (sender, args) => {
+ var selection = await DisplayActionSheet ("Select Horizontal Options", null, null,
+ "Start", "StartAndExpand",
+ "Center", "CenterAndExpand",
+ "End", "EndAndExpand",
+ "Fill", "FillAndExpand");
+
+ result.VerticalOptions = StringToLayoutOptions (selection);
+ };
+
+ return result;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/LayoutPerformanceGallery.cs b/Xamarin.Forms.Controls/GalleryPages/LayoutPerformanceGallery.cs
new file mode 100644
index 0000000..9778e37
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/LayoutPerformanceGallery.cs
@@ -0,0 +1,116 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls.GalleryPages
+{
+ public class LayoutPerformanceGallery : ContentPage
+ {
+ public LayoutPerformanceGallery ()
+ {
+ int size = 3;
+
+ var grid = new Grid {
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ RowDefinitions = {
+ new RowDefinition { Height = new GridLength (100, GridUnitType.Absolute) },
+ new RowDefinition { Height = new GridLength (5, GridUnitType.Star) },
+ new RowDefinition { Height = new GridLength (7, GridUnitType.Star) },
+ },
+ ColumnDefinitions = {
+ new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) },
+ new ColumnDefinition { Width = new GridLength (7, GridUnitType.Star) },
+ }
+ };
+
+ for (int i = 0; i < size; i++) {
+ for (int j = 0; j < size; j++) {
+ var g = new Grid {
+ RowDefinitions = {
+ new RowDefinition { Height = new GridLength (100, GridUnitType.Absolute) },
+ new RowDefinition { Height = new GridLength (5, GridUnitType.Star) },
+ new RowDefinition { Height = new GridLength (7, GridUnitType.Star) },
+ },
+ ColumnDefinitions = {
+ new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) },
+ new ColumnDefinition { Width = new GridLength (7, GridUnitType.Star) },
+ }
+ };
+
+ for (int k = 0; k < size; k++) {
+ for (int l = 0; l < size; l++) {
+ var label = new Label { Text = "10" };
+ g.Children.Add (label, k, l);
+ _labelList.Add (label);
+ }
+ }
+
+ grid.Children.Add (g, i, j);
+ }
+ }
+
+
+
+
+ Content = new StackLayout {
+ Children = {
+ (_mainLabel = new Label ()),
+ grid
+ }
+ };
+ }
+
+ Label _mainLabel = null;
+ List<Label> _labelList = new List<Label> ();
+ Stopwatch _sw = new Stopwatch ();
+ long _ticks = 0;
+ int _count = 0;
+ int _cycle = 0;
+ bool _flip = true;
+ Random _r = new Random (34269027);
+ bool _repeat = false;
+
+ protected override void OnAppearing ()
+ {
+ base.OnAppearing ();
+ _repeat = true;
+ Device.StartTimer (TimeSpan.FromMilliseconds (10), () => {
+ _sw.Start ();
+ foreach (var label in _labelList) {
+ if (_flip) {
+ label.Text = _r.Next (10, 40).ToString ();
+ } else {
+ label.Text = _r.Next (50, 90).ToString ();
+ }
+ }
+ _sw.Stop ();
+ _ticks += _sw.ElapsedMilliseconds;
+ _sw.Reset ();
+
+ _cycle = (_cycle + 1) % 100;
+ _count++;
+ if (_cycle == 0) {
+ _mainLabel.Text = string.Format ("Avg Time: {0:0.000}ms", _ticks / (double)_count);
+ }
+
+ _flip = !_flip;
+ return _repeat;
+ });
+ }
+
+ protected override void OnDisappearing ()
+ {
+ _repeat = false;
+ _ticks = 0;
+ _count = 0;
+ _cycle = 0;
+
+ base.OnDisappearing ();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/LineBreakModeGallery.cs b/Xamarin.Forms.Controls/GalleryPages/LineBreakModeGallery.cs
new file mode 100644
index 0000000..8089bc7
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/LineBreakModeGallery.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class LineBreakModeGallery : ContentPage
+ {
+ public LineBreakModeGallery ()
+ {
+ var label = new Label {
+ Text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
+ };
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Spacing = 0,
+ Children = {
+ MakeLineBreakModeButton ("CharacterWrap", label, LineBreakMode.CharacterWrap),
+ MakeLineBreakModeButton ("HeadTruncation", label, LineBreakMode.HeadTruncation),
+ MakeLineBreakModeButton ("MiddleTruncation", label, LineBreakMode.MiddleTruncation),
+ MakeLineBreakModeButton ("NoWrap", label, LineBreakMode.NoWrap),
+ MakeLineBreakModeButton ("TailTruncation", label, LineBreakMode.TailTruncation),
+ MakeLineBreakModeButton ("WordWrap", label, LineBreakMode.WordWrap),
+ label
+ }
+ }
+ };
+ }
+
+ static Button MakeLineBreakModeButton (string buttonText, Label label, LineBreakMode lineBreakMode) {
+ var button = new Button {
+ Text = buttonText,
+ Command = new Command (() => label.LineBreakMode = lineBreakMode)
+ };
+ return button;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ListPage.cs b/Xamarin.Forms.Controls/GalleryPages/ListPage.cs
new file mode 100644
index 0000000..0eeaf14
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ListPage.cs
@@ -0,0 +1,117 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ListPage : ContentPage
+ {
+ ListScreen _listScreen;
+ public ListPage ()
+ {
+ _listScreen = new ListScreen ();
+ Content = new StackLayout {
+ Children = {
+ new Label {Text = "Foo"},
+ _listScreen.View
+ }
+ };
+ }
+ }
+
+ public class ListScreen
+ {
+ public ListView View { get; private set; }
+
+ internal class A : INotifyPropertyChanged
+ {
+ string _text;
+ public string Text {
+ get {
+ return _text;
+ }
+ set {
+ _text = value;
+ if(PropertyChanged != null)
+ PropertyChanged(this, new PropertyChangedEventArgs("Text"));
+ }
+ }
+
+ #region INotifyPropertyChanged implementation
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ #endregion
+ }
+
+ [Preserve (AllMembers = true)]
+ internal class ViewCellTest : ViewCell
+ {
+ static int s_inc = 0;
+
+ public ViewCellTest ()
+ {
+ var stackLayout = new StackLayout {
+ Orientation = StackOrientation.Horizontal
+ };
+
+ var label = new Label ();
+ label.SetBinding (Label.TextProperty, "Text");
+
+ var box = new BoxView {WidthRequest = 100, HeightRequest = 10, Color = Color.Red};
+
+ stackLayout.Children.Add (label);
+ stackLayout.Children.Add (box);
+
+ View = stackLayout;
+ }
+
+ protected override void OnAppearing ()
+ {
+ base.OnAppearing ();
+ Debug.WriteLine ("Appearing: " + (BindingContext as A)?.Text + " : " + s_inc);
+ s_inc++;
+ }
+
+ protected override void OnDisappearing ()
+ {
+ base.OnDisappearing ();
+ Debug.WriteLine ("Disappearing: " + (BindingContext as A)?.Text + " : " + s_inc);
+ s_inc++;
+ }
+ }
+
+ public ListScreen ()
+ {
+
+ View = new ListView (ListViewCachingStrategy.RecycleElement);
+
+ View.RowHeight = 30;
+
+ var n = 500;
+ var items = Enumerable.Range (0, n).Select (i => new A {Text = i.ToString ()}).ToList ();
+ View.ItemsSource = items;
+
+ View.ItemTemplate = new DataTemplate (typeof (ViewCellTest));
+
+ View.ItemSelected += (sender, e) => {
+ var cell = (e.SelectedItem as A);
+ if (cell == null)
+ return;
+ var x = int.Parse (cell.Text);
+ if (x == 5) {
+ n += 10;
+ View.ItemsSource = Enumerable.Range (0, n).Select (i => new A { Text = i.ToString () }).ToList ();
+ } else {
+ cell.Text = (x + 1).ToString ();
+ }
+ };
+
+
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs b/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs
new file mode 100644
index 0000000..a30ec17
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs
@@ -0,0 +1,231 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ListViewDemoPage : ContentPage
+ {
+ class Person
+ {
+ public Person(string name, DateTime birthday, Color favoriteColor)
+ {
+ Name = name;
+ Birthday = birthday;
+ FavoriteColor = favoriteColor;
+ }
+
+ public string Name { private set; get; }
+
+ public DateTime Birthday { private set; get; }
+
+ public Color FavoriteColor { private set; get; }
+ };
+
+ class MyDataTemplateSelector : DataTemplateSelector
+ {
+ DataTemplate _oddTemplate;
+ DataTemplate _evenTemplate;
+
+ public MyDataTemplateSelector ()
+ {
+ _evenTemplate = new DataTemplate (() => {
+ // Create views with bindings for displaying each property.
+ Label nameLabel = new Label ();
+ nameLabel.SetBinding (Label.TextProperty, "Name");
+
+ Label birthdayLabel = new Label ();
+ birthdayLabel.SetBinding (Label.TextProperty,
+ new Binding ("Birthday", BindingMode.OneWay,
+ null, null, "Born {0:d}"));
+
+ BoxView boxView = new BoxView ();
+ boxView.SetBinding (BoxView.ColorProperty, "FavoriteColor");
+
+ // Return an assembled ViewCell.
+ return new ViewCell {
+ View = new StackLayout {
+ Padding = new Thickness (0, 5),
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ new Image {
+ HeightRequest = 40,
+ WidthRequest = 40,
+ Source = new UriImageSource {
+ // CacheValidity = TimeSpan.FromSeconds (10),
+ Uri = new Uri ("https://xamarin.com/content/images/pages/index/xamarin-studio-icon.png"),
+ }
+ },
+ boxView,
+ new StackLayout {
+ VerticalOptions = LayoutOptions.Center,
+ Spacing = 0,
+ Children = {
+ nameLabel,
+ birthdayLabel
+ }
+ }
+ }
+ }
+ };
+ });
+
+ _oddTemplate = new DataTemplate (() => {
+ // Create views with bindings for displaying each property.
+ Label nameLabel = new Label ();
+ nameLabel.SetBinding (Label.TextProperty, "Name");
+
+ Label birthdayLabel = new Label ();
+ birthdayLabel.SetBinding (Label.TextProperty,
+ new Binding ("Birthday", BindingMode.OneWay,
+ null, null, "Born {0:d}"));
+
+ BoxView boxView = new BoxView ();
+ boxView.SetBinding (BoxView.ColorProperty, "FavoriteColor");
+
+ // Return an assembled ViewCell.
+ return new ViewCell {
+ View = new StackLayout {
+ Padding = new Thickness (0, 5),
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ new Image {
+ HeightRequest = 40,
+ WidthRequest = 40,
+ Source = new UriImageSource {
+ // CacheValidity = TimeSpan.FromSeconds (10),
+ Uri = new Uri ("https://xamarin.com/content/images/pages/index/xamarin-studio-icon.png"),
+ }
+ },
+
+ new StackLayout {
+ VerticalOptions = LayoutOptions.Center,
+ Spacing = 0,
+ Children = {
+ birthdayLabel,
+ nameLabel,
+ }
+ },
+ boxView,
+ }
+ }
+ };
+ });
+ }
+
+ protected override DataTemplate OnSelectTemplate (object item, BindableObject container)
+ {
+ return ((Person)item).Birthday.Month % 2 == 0 ? _evenTemplate : _oddTemplate;
+ }
+ }
+
+ public ListViewDemoPage()
+ {
+ Label header = new Label
+ {
+ Text = "ListView",
+ Font = Font.BoldSystemFontOfSize(50),
+ HorizontalOptions = LayoutOptions.Center
+ };
+
+ // Define some data.
+ List<Person> people = new List<Person>
+ {
+ new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
+ new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
+ new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
+ new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
+ new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
+ new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
+ new Person("Greta", new DateTime(1981, 7, 15), Color.Lime),
+ new Person("Harold", new DateTime(1982, 8, 10), Color.Maroon),
+ new Person("Irene", new DateTime(1983, 9, 25), Color.Navy),
+ new Person("Jonathan", new DateTime(1984, 10, 10), Color.Olive),
+ new Person("Kathy", new DateTime(1985, 11, 20), Color.Purple),
+ new Person("Larry", new DateTime(1986, 12, 5), Color.Red),
+ new Person("Monica", new DateTime(1975, 1, 5), Color.Silver),
+ new Person("Nick", new DateTime(1976, 2, 10), Color.Teal),
+ new Person("Olive", new DateTime(1977, 3, 20), Color.White),
+ new Person("Pendleton", new DateTime(1978, 4, 10), Color.Yellow),
+ new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
+ new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
+ new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
+ new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
+ new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),
+ new Person("Victor", new DateTime(1984, 10, 20), Color.Maroon),
+ new Person("Wendy", new DateTime(1985, 11, 5), Color.Navy),
+ new Person("Xavier", new DateTime(1986, 12, 30), Color.Olive),
+ new Person("Yvonne", new DateTime(1987, 1, 10), Color.Purple),
+ new Person("Zachary", new DateTime(1988, 2, 5), Color.Red)
+ };
+ List<Person> people2 = new List<Person>
+ {
+ new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
+ new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
+ new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
+ new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
+ new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
+ new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
+ new Person("Greta", new DateTime(1981, 7, 15), Color.Lime),
+ new Person("Harold", new DateTime(1982, 8, 10), Color.Maroon),
+ new Person("Irene", new DateTime(1983, 9, 25), Color.Navy),
+ new Person("Jonathan", new DateTime(1984, 10, 10), Color.Olive),
+ new Person("Kathy", new DateTime(1985, 11, 20), Color.Purple),
+ new Person("Larry", new DateTime(1986, 12, 5), Color.Red),
+ new Person("Monica", new DateTime(1975, 1, 5), Color.Silver),
+ new Person("Nick", new DateTime(1976, 2, 10), Color.Teal),
+ new Person("Olive", new DateTime(1977, 3, 20), Color.White),
+ new Person("Pendleton", new DateTime(1978, 4, 10), Color.Yellow),
+ new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
+ new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
+ new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
+ new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
+ new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),
+ new Person("Victor", new DateTime(1984, 10, 20), Color.Maroon),
+ new Person("Wendy", new DateTime(1985, 11, 5), Color.Navy),
+ new Person("Xavier", new DateTime(1986, 12, 30), Color.Olive),
+ new Person("Yvonne", new DateTime(1987, 1, 10), Color.Purple),
+ new Person("Zachary", new DateTime(1988, 2, 5), Color.Red)
+ };
+
+ // Create the ListView.
+ ListView listView = new ListView (ListViewCachingStrategy.RecycleElement)
+ {
+ // Source of data items.
+ ItemsSource = new List<List<Person>> {people, people2},
+ IsPullToRefreshEnabled = true,
+ IsGroupingEnabled = true,
+
+ // Define template for displaying each item.
+ // (Argument of DataTemplate constructor is called for
+ // each item; it must return a Cell derivative.)
+ ItemTemplate = new MyDataTemplateSelector ()
+ };
+
+ listView.Refreshing += async (sender, e) => {
+ await Task.Delay (5000);
+ listView.IsRefreshing = false;
+ };
+
+ listView.ItemSelected += (sender, args) => {
+ if (listView.SelectedItem == null)
+ return;
+ listView.SelectedItem = null;
+ };
+
+ // Accomodate iPhone status bar.
+ Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
+
+ // Build the page.
+ Content = new StackLayout
+ {
+ Children =
+ {
+ header,
+ listView
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/MapGallery.cs b/Xamarin.Forms.Controls/GalleryPages/MapGallery.cs
new file mode 100644
index 0000000..dd283c3
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/MapGallery.cs
@@ -0,0 +1,153 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xamarin.Forms.Maps;
+
+namespace Xamarin.Forms.Controls
+{
+ public class MapGallery : ContentPage
+ {
+ readonly StackLayout _stack;
+
+ public MapGallery ()
+ {
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var map = MakeMap ();
+
+ map.MoveToRegion (MapSpan.FromCenterAndRadius (new Position (41.890202, 12.492049), Distance.FromMiles (0.5)));
+
+ var searchAddress = new SearchBar { Placeholder = "Search Address" };
+
+ searchAddress.SearchButtonPressed += async (e, a) => {
+ var addressQuery = searchAddress.Text;
+ searchAddress.Text = "";
+ searchAddress.Unfocus ();
+
+ var positions = (await (new Geocoder ()).GetPositionsForAddressAsync (addressQuery)).ToList ();
+ if (!positions.Any ())
+ return;
+
+ var position = positions.First ();
+ map.MoveToRegion (MapSpan.FromCenterAndRadius (position,
+ Distance.FromMeters (4000)));
+ map.Pins.Add (new Pin {
+ Label = addressQuery,
+ Position = position,
+ Address = addressQuery
+ });
+ };
+
+ var buttonAddressFromPosition = new Button { Text = "Address From Position" };
+ buttonAddressFromPosition.Clicked += async (e, a) => {
+ var addresses = (await (new Geocoder ()).GetAddressesForPositionAsync (new Position (41.8902, 12.4923))).ToList ();
+ foreach (var ad in addresses)
+ Debug.WriteLine (ad);
+ };
+
+ var buttonZoomIn = new Button { Text = "Zoom In" };
+ buttonZoomIn.Clicked += (e, a) => map.MoveToRegion (map.VisibleRegion.WithZoom (5f));
+
+ var buttonZoomOut = new Button { Text = "Zoom Out" };
+ buttonZoomOut.Clicked += (e, a) => map.MoveToRegion (map.VisibleRegion.WithZoom (1 / 3f));
+
+ var mapTypeButton = new Button { Text = "Map Type" };
+ mapTypeButton.Clicked += async (e, a) => {
+ var result = await DisplayActionSheet ("Select Map Type", null, null, "Street", "Satellite", "Hybrid");
+ switch (result) {
+ case "Street":
+ map.MapType = MapType.Street;
+ break;
+ case "Satellite":
+ map.MapType = MapType.Satellite;
+ break;
+ case "Hybrid":
+ map.MapType = MapType.Hybrid;
+ break;
+ }
+ };
+
+ var buttonHome = new Button { Text = "Home" };
+ buttonHome.Clicked += (a, e) => {
+ map.MoveToRegion (MapSpan.FromCenterAndRadius (new Position (41.890202, 12.492049), Distance.FromMiles (0.5)));
+ };
+
+ _stack = new StackLayout {
+ Spacing = 0,
+ Padding = new Thickness (30, 0)
+ };
+ //stack.SetRowSpacing (1, 0);
+
+ Title = "Map Gallery";
+
+ var buttonZoomPin = new Button { Text = "Zoom Pin" };
+ buttonZoomPin.Clicked += (a, e) => {
+ var pos = new Position (41.011995, -8.642995);
+ map.Pins.Clear ();
+ map.Pins.Add (new Pin { Position = pos, Label = "Rui" });
+ map.MoveToRegion (MapSpan.FromCenterAndRadius (pos, Distance.FromMiles (0.5)));
+ };
+
+
+ map.VerticalOptions = LayoutOptions.FillAndExpand;
+ _stack.Children.Add (searchAddress);
+ _stack.Children.Add (map);
+ _stack.Children.Add (mapTypeButton);
+ _stack.Children.Add (buttonZoomIn);
+ _stack.Children.Add (buttonZoomOut);
+ _stack.Children.Add (buttonAddressFromPosition);
+ _stack.Children.Add (buttonHome);
+ _stack.Children.Add (buttonZoomPin);
+
+ Content = _stack;
+ }
+
+ public static Map MakeMap ()
+ {
+ Pin colosseum = null;
+ Pin pantheon = null;
+ Pin chapel = null;
+
+ var map = new Map {
+ IsShowingUser = false,
+ Pins = {
+ (colosseum = new Pin {
+ Type = PinType.Place,
+ Position = new Position (41.890202, 12.492049),
+ Label = "Colosseum",
+ Address = "Piazza del Colosseo, 00184 Rome, Province of Rome, Italy"
+ }),
+ (pantheon = new Pin {
+ Type = PinType.Place,
+ Position = new Position (41.898652, 12.476831),
+ Label = "Pantheon",
+ Address = "Piazza della Rotunda, 00186 Rome, Province of Rome, Italy"
+ }),
+ (chapel = new Pin {
+ Type = PinType.Place,
+ Position = new Position (41.903209, 12.454545),
+ Label = "Sistine Chapel",
+ Address = "Piazza della Rotunda, 00186 Rome, Province of Rome, Italy"
+ })
+ }
+ };
+
+ colosseum.Clicked += PinClicked;
+ pantheon.Clicked += PinClicked;
+ chapel.Clicked += PinClicked;
+ return map;
+ }
+
+ static void PinClicked (object sender, EventArgs e)
+ {
+ // yea!
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/MasterDetailPageTabletPage.cs b/Xamarin.Forms.Controls/GalleryPages/MasterDetailPageTabletPage.cs
new file mode 100644
index 0000000..f8aba26
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/MasterDetailPageTabletPage.cs
@@ -0,0 +1,40 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ public class MasterDetailPageTabletPage : ContentPage
+ {
+ public MasterDetailPageTabletPage ()
+ {
+ Title = "MasterDetail MasterBehavior Gallery";
+
+ var btn = new Button { Text = "Default (old behavior)" };
+ btn.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.Default,null));
+
+ var btn1 = new Button { Text = "Default (old behavior) but always hide toolbar button" };
+ btn1.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.Default,false));
+
+ var btn2 = new Button { Text = "Popover - (always show it as a popover) but hide toolbar button" };
+ btn2.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.Popover,false));
+
+ //there's never a time when to real hide the master i think, use a normal page for that..
+ //what the user wants is out of the screen, maybe we need a better namming
+ var btn3 = new Button { Text = "Popover - (always show it as a popover)" };
+ btn3.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.Popover, null));
+
+ //we throw an exception here if you try to toggle it
+ var btn4 = new Button { Text = "Split - (always show it as splitview , toogle master always visible, throws expception)" };
+ btn4.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.Split, null));
+
+ var btn5 = new Button { Text = "SplitOnPortrait Portrait - (always show it as splitview in Portrait, throws expception)" };
+ btn5.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.SplitOnPortrait, null));
+
+ var btn6 = new Button { Text = "SplitOnLandscape Landscape - (always show it as splitview in Landscape, throws expception))" };
+ btn6.Clicked += async (sender, e) => await Navigation.PushModalAsync (new Issue1461Page (MasterBehavior.SplitOnLandscape, null));
+
+ Content = new StackLayout { Padding= new Thickness(0,20,0,0) , Children = { btn, btn1, btn2, btn6, btn3, btn4, btn5 }, Spacing = 20 };
+
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/MinimumSizeGallery.cs b/Xamarin.Forms.Controls/GalleryPages/MinimumSizeGallery.cs
new file mode 100644
index 0000000..1ad9057
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/MinimumSizeGallery.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class MinimumSizeGallery : ContentPage
+ {
+ public MinimumSizeGallery ()
+ {
+ Content = new StackLayout {
+ Children = {
+ new Button { Text = "Big Button", HeightRequest = 300 },
+ new TableView {
+ Intent = TableIntent.Settings,
+ Root = new TableRoot {
+ new TableSection ("SECTION 1") {
+ new TextCell { Text = "Cell 1", Detail = "Red Text", TextColor = Color.Red },
+ new TextCell { Text = "Detail Red", Detail = "Detail", DetailColor = Color.Red },
+ new TextCell { Text = "Cell 3" },
+ new TextCell { Text = "Cell 4" }
+ },
+ new TableSection ("Section 2") {
+ new TextCell { Text = "Cell 1" },
+ new TextCell { Text = "Cell 2" },
+ new TextCell { Text = "Cell 3" },
+ new TextCell { Text = "Cell 4" }
+ },
+ new TableSection ("Section 3") {
+ new TextCell { Text = "Cell 1" },
+ new TextCell { Text = "Cell 2" },
+ new TextCell { Text = "Cell 3" },
+ new TextCell { Text = "Cell 4" }
+ },
+ new TableSection ("Section 4") {
+ new TextCell { Text = "Cell 1" },
+ new TextCell { Text = "Cell 2" },
+ new TextCell { Text = "Cell 3" },
+ new TextCell { Text = "Cell 4 Last" }
+ }
+ }
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/MultiGallery.cs b/Xamarin.Forms.Controls/GalleryPages/MultiGallery.cs
new file mode 100644
index 0000000..02ceab0
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/MultiGallery.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class MultiGallery : ContentPage
+ {
+ public MultiGallery ()
+ {
+ var button = new Button {Text = "Toggle Nav Bar"};
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Children = {
+ button,
+ new Editor (),
+ new Entry (),
+ new Image {Source = ImageSource.FromFile ("cover1.jpg")},
+ new Label {Text = "Label"},
+ new ProgressBar (),
+ new ActivityIndicator (),
+ new Switch (),
+ new Stepper (),
+ new Slider (),
+ new ProgressBar (),
+ new ActivityIndicator (),
+ new Switch (),
+ new Stepper (),
+ new Slider ()
+ }
+ }
+ };
+
+ button.Clicked +=
+ (sender, args) => NavigationPage.SetHasNavigationBar (this, !NavigationPage.GetHasNavigationBar (this));
+
+ ToolbarItems.Add (new ToolbarItem ("Back", "bank.png", () => Navigation.PopAsync (), ToolbarItemOrder.Primary));
+ ToolbarItems.Add (new ToolbarItem ("It's", "bank.png", () => Navigation.PopAsync (), ToolbarItemOrder.Secondary));
+ ToolbarItems.Add (new ToolbarItem ("A", "bank.png", () => Navigation.PopAsync (), ToolbarItemOrder.Secondary));
+ ToolbarItems.Add (new ToolbarItem ("TARP!", "bank.png", () => Navigation.PopAsync (), ToolbarItemOrder.Secondary));
+ }
+
+ protected override void OnAppearing ()
+ {
+ Debug.WriteLine ("Appearing");
+ base.OnAppearing ();
+ }
+
+ protected override void OnDisappearing ()
+ {
+ Debug.WriteLine ("Disappearing");
+ base.OnDisappearing ();
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs b/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs
new file mode 100644
index 0000000..dfbc342
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs
@@ -0,0 +1,62 @@
+using System.Diagnostics;
+
+namespace Xamarin.Forms.Controls
+{
+ public class NavigationBarGallery : ContentPage
+ {
+ public NavigationBarGallery (NavigationPage rootNavPage)
+ {
+
+ int toggleBarTextColor = 0;
+ int toggleBarBackgroundColor = 0;
+
+ Content = new StackLayout {
+ Children = {
+ new Button {
+ Text = "Change BarTextColor",
+ Command = new Command (() => {
+ if (toggleBarTextColor % 2 == 0) {
+ rootNavPage.BarTextColor = Color.Teal;
+ } else {
+ rootNavPage.BarTextColor = Color.Default;
+ }
+ toggleBarTextColor++;
+ })
+ },
+ new Button {
+ Text = "Change BarBackgroundColor",
+ Command = new Command (() => {
+ if (toggleBarBackgroundColor % 2 == 0) {
+ rootNavPage.BarBackgroundColor = Color.Navy;
+ } else {
+ rootNavPage.BarBackgroundColor = Color.Default;
+ }
+ toggleBarBackgroundColor++;
+
+ })
+ },
+ new Button {
+ Text = "Change Both to default",
+ Command = new Command (() => {
+ rootNavPage.BarTextColor = Color.Default;
+ rootNavPage.BarBackgroundColor = Color.Default;
+ })
+ },
+ new Button {
+ Text = "Make sure Tint still works",
+ Command = new Command (() => {
+ rootNavPage.Tint = Color.Red;
+ })
+ },
+ new Button {
+ Text = "Black background, white text",
+ Command = new Command (() => {
+ rootNavPage.BarTextColor = Color.White;
+ rootNavPage.BarBackgroundColor = Color.Black;
+ })
+ }
+ }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/NavigationMenuGallery.cs b/Xamarin.Forms.Controls/GalleryPages/NavigationMenuGallery.cs
new file mode 100644
index 0000000..d63745d
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/NavigationMenuGallery.cs
@@ -0,0 +1,38 @@
+using System.Diagnostics;
+
+namespace Xamarin.Forms.Controls
+{
+ public class NavigationMenuGallery : ContentPage
+ {
+ public NavigationMenuGallery ()
+ {
+ Content = new ScrollView {
+ Content = new NavigationMenu {
+ Targets = new[] {
+ new ContentPage {
+ Content =
+ new Label {
+ Text = "Test 1",
+ VerticalOptions = LayoutOptions.Center,
+ HorizontalOptions = LayoutOptions.Center
+ },
+ Title = "Testing 1",
+ Icon = "cover1.jpg"
+ },
+ new ContentPage { Content = new Label { Text = "Test 2" }, Title = "Testing 2", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 3" }, Title = "Testing 3", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 4" }, Title = "Testing 4", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 5" }, Title = "Testing 5", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 6" }, Title = "Testing 6", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 7" }, Title = "Testing 7", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 8" }, Title = "Testing 8", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 9" }, Title = "Testing 9", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 10" }, Title = "Testing 10", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 11" }, Title = "Testing 11", Icon = "cover1.jpg" },
+ new ContentPage { Content = new Label { Text = "Test 12" }, Title = "Testing 12", Icon = "cover1.jpg" }
+ }
+ }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/GalleryPages/NavigationPropertiesGallery.cs b/Xamarin.Forms.Controls/GalleryPages/NavigationPropertiesGallery.cs
new file mode 100644
index 0000000..0628cfa
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/NavigationPropertiesGallery.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class NavigationPropertiesGallery
+ : ContentPage
+ {
+ public NavigationPropertiesGallery ()
+ {
+ var noBack = new ContentPage {
+ Title = "No back button",
+ };
+ NavigationPage.SetHasBackButton (noBack, false);
+ var toggleBackButton = new Button { Text = "Toggle Back Button" };
+ toggleBackButton.Clicked += (sender, e) => {
+ var hasBack = NavigationPage.GetHasBackButton (noBack);
+ if (hasBack)
+ NavigationPage.SetHasBackButton (noBack, false);
+ else
+ NavigationPage.SetHasBackButton (noBack, true);
+ };
+ noBack.Content = toggleBackButton;
+
+
+ var noBar = new ContentPage {
+ Title = "No bar",
+ Content = new Label {
+ Text = "No bar content",
+ Style = Device.Styles.TitleStyle
+ }
+ };
+
+ var backTitle = new ContentPage {
+ Title = "Back button title"
+ };
+
+ NavigationPage.SetHasNavigationBar (noBar, false);
+
+ Content = new ListView {
+ ItemsSource = new[] {
+ noBack,
+ noBar,
+ backTitle
+ },
+
+ ItemTemplate = new DataTemplate (typeof(TextCell)) {
+ Bindings = {
+ { TextCell.TextProperty, new Binding ("Title") }
+ }
+ }
+ };
+
+ ((ListView) Content).ItemTapped += async (sender, args) => {
+ await Navigation.PushAsync ((Page) args.Item);
+ };
+
+ NavigationPage.SetBackButtonTitle (this, "Back Title");
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs b/Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs
new file mode 100644
index 0000000..bb5ce8a
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+#if HAVE_OPENTK
+using OpenTK.Graphics;
+using OpenTK.Graphics.ES20;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+#if HAVE_OPENTK
+ public class OpenGLGallery : ContentPage
+ {
+ float red, green, blue;
+
+ public OpenGLGallery ()
+ {
+ var view = new OpenGLView {HasRenderLoop = true};
+ var toggle = new Switch {IsToggled = true};
+ var button = new Button {Text = "Display"};
+
+ view.HeightRequest = 300;
+ view.WidthRequest = 300;
+
+ view.OnDisplay = r =>{
+ /*
+ if (!inited) {
+ var shader = GL.CreateShader (All.VertexShader);
+ int length = 0;
+ GL.ShaderSource (shader, 1, new string [] { "void main() { gl_FragColor = vec4(0.6, 1.0, 0.0, 1.0); }"}, ref length);
+ GL.CompileShader (shader);
+ int status = 0;
+ GL.GetShader (shader, All.CompileStatus, ref status);
+ if (status == 0) {
+ GL.DeleteShader (shader);
+ throw new Exception();
+ }
+
+ inited = true;
+ }
+ */
+ GL.ClearColor (red, green, blue, 1.0f);
+ GL.Clear ((ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit));
+
+ red += 0.01f;
+ if (red >= 1.0f)
+ red -= 1.0f;
+ green += 0.02f;
+ if (green >= 1.0f)
+ green -= 1.0f;
+ blue += 0.03f;
+ if (blue >= 1.0f)
+ blue -= 1.0f;
+ };
+
+ toggle.Toggled += (s, a) => { view.HasRenderLoop = toggle.IsToggled; };
+ button.Activated += (s, a) => view.Display ();
+
+ var stack = new StackLayout {Padding = new Size (20, 20)};
+ stack.Add (view);
+ stack.Add (toggle);
+ stack.Add (button);
+
+ Content = stack;
+ }
+ }
+#endif
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/PickerGallery.cs b/Xamarin.Forms.Controls/GalleryPages/PickerGallery.cs
new file mode 100644
index 0000000..676c907
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/PickerGallery.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class PickerGallery : ContentPage
+ {
+ public PickerGallery ()
+ {
+ var picker = new Picker {Title="Dismiss in one sec", Items = {"John", "Paul", "George", "Ringo"}};
+ picker.Focused += async (object sender, FocusEventArgs e) => {
+ await Task.Delay (1000);
+ picker.Unfocus ();
+ };
+
+ Label testLabel = new Label { Text = "", AutomationId="test", ClassId="test" };
+
+ Picker p1 = new Picker { Title = "Pick a number", Items = { "0", "1", "2", "3", "4", "5", "6" }};
+ p1.SelectedIndexChanged += (sender, e) => {
+ testLabel.Text = "Selected Index Changed";
+ };
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Padding = new Thickness (20, 20),
+ Children = {
+ new DatePicker (),
+ new TimePicker (),
+ new DatePicker { Format = "D" },
+ new TimePicker { Format = "T" },
+ new Picker {Title = "Set your favorite Beatle", Items = {"John", "Paul", "George", "Ringo"}},
+ new Picker {Title = "Set your favorite Stone", Items = {"Mick", "Keith", "Charlie", "Ronnie"}, SelectedIndex = 1},
+ new Picker {Title = "Pick", Items = {"Jason Smith", "Rui Marinho", "Eric Maupin", "Chris King"}, HorizontalOptions = LayoutOptions.CenterAndExpand},
+ picker,
+ testLabel,
+ p1
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ProgressBarGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ProgressBarGallery.cs
new file mode 100644
index 0000000..3190a3c
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ProgressBarGallery.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ProgressBarGallery : ContentPage
+ {
+ readonly StackLayout _stack;
+
+ public ProgressBarGallery ()
+ {
+ _stack = new StackLayout ();
+
+ var normal = new ProgressBar {
+ Progress = 0.24
+ };
+
+ Content = _stack;
+
+ _stack.Children.Add (normal);
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/RelativeLayoutGallery.cs b/Xamarin.Forms.Controls/GalleryPages/RelativeLayoutGallery.cs
new file mode 100644
index 0000000..1feaafe
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/RelativeLayoutGallery.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class RelativeLayoutGallery : ContentPage
+ {
+ public RelativeLayoutGallery()
+ {
+ var layout = new RelativeLayout ();
+
+ var box1 = new ContentView {
+ BackgroundColor = Color.Gray,
+ Content = new Label {
+ Text = "0"
+ }
+ };
+
+ double padding = 10;
+ layout.Children.Add (box1, () => new Rectangle (((layout.Width + padding) % 60) / 2, padding, 50, 50));
+
+ var last = box1;
+ for (int i = 0; i < 200; i++) {
+ var relativeTo = last; // local copy
+ var box = new ContentView {
+ BackgroundColor = Color.Gray,
+ Content = new Label {
+ Text = (i+1).ToString ()
+ }
+ };
+
+ Func<View, bool> pastBounds = view => relativeTo.Bounds.Right + padding + relativeTo.Width > layout.Width;
+ layout.Children.Add (box, () => new Rectangle (pastBounds (relativeTo) ? box1.X : relativeTo.Bounds.Right + padding,
+ pastBounds (relativeTo) ? relativeTo.Bounds.Bottom + padding : relativeTo.Y,
+ relativeTo.Width,
+ relativeTo.Height));
+
+ last = box;
+ }
+
+ Content = new ScrollView {Content = layout, Padding = new Thickness(50)};
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ScaleRotate.cs b/Xamarin.Forms.Controls/GalleryPages/ScaleRotate.cs
new file mode 100644
index 0000000..e189f83
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ScaleRotate.cs
@@ -0,0 +1,157 @@
+using System;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ScaleRotate : ContentPage
+ {
+ public ScaleRotate()
+ {
+ Label label = new Label
+ {
+ Text = "SCALE AND\nROTATE",
+ HorizontalTextAlignment = TextAlignment.Center,
+ HorizontalOptions = LayoutOptions.Center,
+ VerticalOptions = LayoutOptions.CenterAndExpand
+ };
+
+ // Label and Slider for Scale property.
+ Label scaleSliderValue = new Label
+ {
+ VerticalTextAlignment = TextAlignment.Center
+ };
+ Grid.SetRow(scaleSliderValue, 0);
+ Grid.SetColumn(scaleSliderValue, 0);
+
+ Slider scaleSlider = new Slider
+ {
+ Maximum = 10
+ };
+ Grid.SetRow(scaleSlider, 0);
+ Grid.SetColumn(scaleSlider, 1);
+
+ // Set Bindings.
+ scaleSliderValue.BindingContext = scaleSlider;
+ scaleSliderValue.SetBinding(Label.TextProperty,
+ new Binding("Value", BindingMode.OneWay, null, null, "Scale = {0:F1}"));
+
+ scaleSlider.BindingContext = label;
+ scaleSlider.SetBinding(Slider.ValueProperty,
+ new Binding("Scale", BindingMode.TwoWay));
+
+ // Label and Slider for Rotation property.
+ Label rotationSliderValue = new Label
+ {
+ VerticalTextAlignment = TextAlignment.Center
+ };
+ Grid.SetRow(rotationSliderValue, 1);
+ Grid.SetColumn(rotationSliderValue, 0);
+
+ Slider rotationSlider = new Slider
+ {
+ Maximum = 360
+ };
+ Grid.SetRow(rotationSlider, 1);
+ Grid.SetColumn(rotationSlider, 1);
+
+ // Set Bindings.
+ rotationSliderValue.BindingContext = rotationSlider;
+ rotationSliderValue.SetBinding(Label.TextProperty,
+ new Binding("Value", BindingMode.OneWay, null, null, "Rotation = {0:F0}"));
+
+ rotationSlider.BindingContext = label;
+ rotationSlider.SetBinding(Slider.ValueProperty,
+ new Binding("Rotation", BindingMode.TwoWay));
+
+ // Label and Slider for AnchorX property.
+ Label anchorxStepperValue = new Label
+ {
+ VerticalTextAlignment = TextAlignment.Center
+ };
+ Grid.SetRow(anchorxStepperValue, 2);
+ Grid.SetColumn(anchorxStepperValue, 0);
+
+ Stepper anchorxStepper = new Stepper
+ {
+ Maximum = 2,
+ Minimum = -1,
+ Increment = 0.5
+ };
+ Grid.SetRow(anchorxStepper, 2);
+ Grid.SetColumn(anchorxStepper, 1);
+
+ // Set bindings.
+ anchorxStepperValue.BindingContext = anchorxStepper;
+ anchorxStepperValue.SetBinding(Label.TextProperty,
+ new Binding("Value", BindingMode.OneWay, null, null, "AnchorX = {0:F1}"));
+
+ anchorxStepper.BindingContext = label;
+ anchorxStepper.SetBinding(Stepper.ValueProperty,
+ new Binding("AnchorX", BindingMode.TwoWay));
+
+ // Label and Slider for AnchorY property.
+ Label anchoryStepperValue = new Label
+ {
+ VerticalTextAlignment = TextAlignment.Center
+ };
+ Grid.SetRow(anchoryStepperValue, 3);
+ Grid.SetColumn(anchoryStepperValue, 0);
+
+ Stepper anchoryStepper = new Stepper
+ {
+ Maximum = 2,
+ Minimum = -1,
+ Increment = 0.5
+ };
+ Grid.SetRow(anchoryStepper, 3);
+ Grid.SetColumn(anchoryStepper, 1);
+
+ // Set bindings.
+ anchoryStepperValue.BindingContext = anchoryStepper;
+ anchoryStepperValue.SetBinding(Label.TextProperty,
+ new Binding("Value", BindingMode.OneWay, null, null, "AnchorY = {0:F1}"));
+
+ anchoryStepper.BindingContext = label;
+ anchoryStepper.SetBinding(Stepper.ValueProperty,
+ new Binding("AnchorY", BindingMode.TwoWay));
+
+ // Assemble the page.
+ Content = new StackLayout
+ {
+ Children =
+ {
+ label,
+ new Grid
+ {
+ Padding = 10,
+ RowDefinitions =
+ {
+ new RowDefinition { Height = GridLength.Auto },
+ new RowDefinition { Height = GridLength.Auto },
+ new RowDefinition { Height = GridLength.Auto },
+ new RowDefinition { Height = GridLength.Auto },
+ },
+ ColumnDefinitions =
+ {
+ new ColumnDefinition { Width = GridLength.Auto },
+ new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)}
+ },
+ Children =
+ {
+ scaleSliderValue,
+ scaleSlider,
+ rotationSliderValue,
+ rotationSlider,
+ anchorxStepperValue,
+ anchorxStepper,
+ anchoryStepperValue,
+ anchoryStepper
+ }
+ }
+ }
+ };
+ }
+ }
+}
+
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/ScrollGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ScrollGallery.cs
new file mode 100644
index 0000000..cf00482
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ScrollGallery.cs
@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ScrollGallery : ContentPage
+ {
+ readonly ScrollView _scrollview;
+ readonly StackLayout _stack;
+ ScrollOrientation _orientation;
+ List<Button> _buttons = new List<Button> ();
+ Button _toNavigateTo;
+ public ScrollGallery (ScrollOrientation orientation = ScrollOrientation.Vertical)
+ {
+ _orientation = orientation;
+ var root = new Grid ();
+ root.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto });
+ root.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto });
+ root.RowDefinitions.Add (new RowDefinition () { Height = GridLength.Auto });
+ root.RowDefinitions.Add (new RowDefinition ());
+
+ var btnStack1 = new StackLayout { Orientation = StackOrientation.Horizontal };
+ var btnStack = new StackLayout { Orientation = StackOrientation.Horizontal };
+ var btn = new Button { Text = "Scroll to 100" };
+ var btn4 = new Button { Text = "Scroll to 100 no anim" };
+ var btn1 = new Button { Text = "Start" };
+ var btn2 = new Button { Text = "Center" };
+ var btn3 = new Button { Text = "End" };
+ var btn6 = new Button { Text = "MakeVisible", HorizontalOptions= LayoutOptions.CenterAndExpand, BackgroundColor = Color.Accent };
+
+ var label = new Label { Text = string.Format ("X: {0}, Y: {1}", 0, 0) };
+
+ root.Children.Add (label);
+ root.Children.Add (btnStack);
+ root.Children.Add (btnStack1);
+
+ btnStack.Children.Add (btn1);
+ btnStack.Children.Add (btn2);
+ btnStack.Children.Add (btn3);
+
+ btnStack1.Children.Add (btn);
+ btnStack1.Children.Add (btn4);
+
+ Grid.SetRow (btnStack, 1);
+ Grid.SetRow (btnStack1, 2);
+
+ var grid = new Grid ();
+ grid.RowDefinitions.Add (new RowDefinition { Height = GridLength.Auto });
+ grid.RowDefinitions.Add (new RowDefinition ());
+ _stack = new StackLayout ();
+ Grid.SetRow (_stack, 1);
+ grid.Children.Add (btn6);
+ grid.Children.Add (_stack);
+ _scrollview = new ScrollView {
+ AutomationId="thescroller",
+ BackgroundColor = Color.Aqua,
+ Content = grid
+ };
+ root.Children.Add (_scrollview);
+ Grid.SetRow (_scrollview, 3);
+
+ _scrollview.Scrolled+= (object sender, ScrolledEventArgs e) => {
+ label.Text = string.Format ("X: {0}, Y: {1}", e.ScrollX, e.ScrollY);
+ };
+
+ btn.Clicked += async (object sender, EventArgs e) => {
+ switch (orientation) {
+ case ScrollOrientation.Horizontal:
+ await _scrollview.ScrollToAsync (100, 0, true);
+ break;
+ case ScrollOrientation.Vertical:
+ await _scrollview.ScrollToAsync (0, 100, true);
+ break;
+ case ScrollOrientation.Both:
+ await _scrollview.ScrollToAsync (100, 100, true);
+ break;
+ }
+ };
+ btn4.Clicked += async (object sender, EventArgs e) => {
+ switch (orientation) {
+ case ScrollOrientation.Horizontal:
+ await _scrollview.ScrollToAsync (100, 0, false);
+ break;
+ case ScrollOrientation.Vertical:
+ await _scrollview.ScrollToAsync (0, 100, false);
+ break;
+ case ScrollOrientation.Both:
+ await _scrollview.ScrollToAsync (100, 100, true);
+ break;
+ }
+ };
+
+ btn1.Clicked += async (object sender, EventArgs e) => {
+ await _scrollview.ScrollToAsync (_toNavigateTo, ScrollToPosition.Start, true);
+ };
+ btn2.Clicked += async (object sender, EventArgs e) => {
+ await _scrollview.ScrollToAsync (_toNavigateTo, ScrollToPosition.Center, true);
+ };
+ btn3.Clicked += async (object sender, EventArgs e) => {
+ await _scrollview.ScrollToAsync (_toNavigateTo, ScrollToPosition.End, true);
+ };
+ btn6.Clicked += async (object sender, EventArgs e) => {
+ await _scrollview.ScrollToAsync (_toNavigateTo, ScrollToPosition.MakeVisible, true);
+ };
+
+ _stack.Padding = new Size (20, 60);
+
+ PopulateStack (_stack);
+
+ _scrollview.Orientation = _orientation;
+
+ if (orientation == ScrollOrientation.Horizontal || orientation == ScrollOrientation.Both) {
+ _stack.Orientation = StackOrientation.Horizontal;
+ }
+
+ if (orientation == ScrollOrientation.Both) {
+ var stack2 = new StackLayout ();
+ PopulateStack (stack2);
+ _stack.Children.Add (stack2);
+ }
+
+ Content = root;
+ }
+
+ void PopulateStack (StackLayout stack)
+ {
+ for (int i = 0; i < 100; i++) {
+
+ var newButton = new Button { Text = "Foo Bar", AutomationId =string.Format ("btn_{0}", i) };
+ if (i == 49)
+ newButton.Text = "the before";
+
+ if (i == 50) {
+ newButton.Text = "the scrollto button";
+ newButton.BackgroundColor = Color.Yellow;
+ newButton.TextColor = Color.Black;
+ _toNavigateTo = newButton;
+ }
+ if (i == 51)
+ newButton.Text = "the after";
+ if (i == 53) {
+ newButton.Text = "the make visible from start";
+ newButton.Clicked += async (object sender, EventArgs e) => {
+ await _scrollview.ScrollToAsync (_toNavigateTo, ScrollToPosition.MakeVisible, true);
+ };
+ }
+
+ _buttons.Add (newButton);
+ stack.Children.Add (newButton);
+ }
+
+ stack.Children.Add (new Button { Text = "Foo Bottom" });
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/SearchBarGallery.cs b/Xamarin.Forms.Controls/GalleryPages/SearchBarGallery.cs
new file mode 100644
index 0000000..c0b91e7
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/SearchBarGallery.cs
@@ -0,0 +1,128 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class SearchBarGallery : ContentPage
+ {
+ Label _searchQueryLabel;
+
+ public SearchBarGallery ()
+ {
+ _searchQueryLabel = new Label {
+ Text = "Search Query"
+ };
+
+ var textChangedLabel = new Label {
+ Text = ""
+ };
+
+ var numCharsTyped = 0;
+
+ var noPlaceholder = new SearchBar();
+ noPlaceholder.SearchButtonPressed += OnSearchBarPressed;
+ noPlaceholder.TextChanged += (sender, e) => {
+ numCharsTyped++;
+ textChangedLabel.Text = numCharsTyped.ToString ();
+ };
+
+ var normal = new SearchBar { Placeholder = "Normal" };
+ normal.SearchButtonPressed += OnSearchBarPressed;
+ normal.TextChanged += (sender, e) => {
+ numCharsTyped++;
+ textChangedLabel.Text = numCharsTyped.ToString ();
+ };
+
+ var activation = new SearchBar { Placeholder = "Activation" };
+ activation.SearchButtonPressed += OnSearchBarPressed;
+ activation.TextChanged += (sender, e) => {
+ numCharsTyped++;
+ textChangedLabel.Text = numCharsTyped.ToString ();
+ };
+
+ var nextPageButton = new Button {
+ Text = "More SearchBars",
+ Command = new Command (async () => await Navigation.PushAsync (new SearchBarGalleryPageTwo ()))
+ };
+
+ int i = 1;
+ activation.SearchButtonPressed += (sender, e) => {
+ activation.Text = "";
+ activation.Placeholder = "Activated " + i++.ToString ();
+ };
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Spacing = 0,
+ Children = {
+ noPlaceholder,
+ normal,
+ activation,
+ _searchQueryLabel,
+ textChangedLabel,
+ nextPageButton
+ }
+ }
+ };
+ }
+
+ void OnSearchBarPressed(object sender, EventArgs eventArgs)
+ {
+ var searchBar = (SearchBar)sender;
+ _searchQueryLabel.Text = searchBar.Text;
+ }
+ }
+
+ public class SearchBarGalleryPageTwo : ContentPage
+ {
+ Label _searchQueryLabel;
+
+ public SearchBarGalleryPageTwo ()
+ {
+ Title = "Search Bar Gallery Part 2";
+
+ _searchQueryLabel = new Label {
+ Text = "Search Query 2"
+ };
+
+ var disabled = new SearchBar { Placeholder = "Disabled", IsEnabled = false };
+ disabled.SearchButtonPressed += OnSearchBarPressed;
+ var transparent = new SearchBar { Placeholder = "Transparent", Opacity = 0.5 };
+ transparent.SearchButtonPressed += OnSearchBarPressed;
+
+ var toggleDisabledButton = new Button {
+ Text = "Toggle enabled",
+ Command = new Command (() => {
+ if (disabled.IsEnabled) {
+ disabled.IsEnabled = false;
+ disabled.Placeholder = "Disabled";
+ } else {
+ disabled.IsEnabled = true;
+ disabled.Placeholder = "Enabled";
+ }
+ })
+ };
+
+ Content = new ScrollView {
+ Content = new StackLayout {
+ Spacing = 0,
+ Children = {
+ disabled,
+ transparent,
+ _searchQueryLabel,
+ toggleDisabledButton
+ }
+ }
+ };
+ }
+
+ void OnSearchBarPressed(object sender, EventArgs eventArgs)
+ {
+ var searchBar = (SearchBar)sender;
+ _searchQueryLabel.Text = searchBar.Text;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/SettingsPage.cs b/Xamarin.Forms.Controls/GalleryPages/SettingsPage.cs
new file mode 100644
index 0000000..b60af11
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/SettingsPage.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class SettingsPage : ContentPage
+ {
+ SettingsScreen _settingsScreen;
+ public SettingsPage ()
+ {
+ _settingsScreen = new SettingsScreen ();
+ Content = _settingsScreen;
+ }
+ }
+
+ public class SettingsScreen : TableView
+ {
+ public SettingsScreen ()
+ {
+ Intent = TableIntent.Settings;
+ var cell = new TextCell { Text = "Coverflow", Detail = "Value 1" };
+
+ var boolCell = new SwitchCell { Text = "Off" };
+ boolCell.OnChanged += (sender, arg) => boolCell.Text = boolCell.On ? "On" : "Off";
+
+ var root = new TableRoot () {
+ new TableSection () {
+ cell,
+ new TextCell { Text = "Cell 2", Detail = "Value 2" },
+ new EntryCell {
+ Label = "Label",
+ Placeholder = "Placeholder 1",
+ HorizontalTextAlignment = TextAlignment.Center,
+ Keyboard = Keyboard.Numeric
+ },
+ new ImageCell { Text = "Hello", Detail = "World", ImageSource = "cover1.jpg" }
+ },
+ new TableSection ("Styles") {
+ boolCell,
+ new EntryCell {
+ Label = "Label2",
+ Placeholder = "Placeholder 2",
+ HorizontalTextAlignment = TextAlignment.Center,
+ Keyboard = Keyboard.Chat
+ },
+ },
+ new TableSection ("Custom Cells") {
+ new ViewCell { View = new Button (){ Text = "Hi" } },
+ }
+ };
+ Root = root;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/SliderGallery.cs b/Xamarin.Forms.Controls/GalleryPages/SliderGallery.cs
new file mode 100644
index 0000000..4fd9f20
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/SliderGallery.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class SliderGallery : ContentPage
+ {
+ public SliderGallery ()
+ {
+ var normal = new Slider (20, 100, 20);
+ var disabled = new Slider (0, 1, 0);
+ var transparent = new Slider (0, 1, 0);
+ var valueLabel = new Label { Text = normal.Value.ToString () };
+
+ disabled.IsEnabled = false;
+ transparent.Opacity = .5;
+ normal.ValueChanged += (sender, e) => { valueLabel.Text = normal.Value.ToString (); };
+
+ Content = new StackLayout {
+ Padding = new Thickness (40),
+ Children = {
+ normal,
+ disabled,
+ transparent,
+ valueLabel
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/StackLayoutGallery.cs b/Xamarin.Forms.Controls/GalleryPages/StackLayoutGallery.cs
new file mode 100644
index 0000000..b08b5f3
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/StackLayoutGallery.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class StackLayoutGallery : ContentPage
+ {
+ public StackLayoutGallery ()
+ {
+ Device.OnPlatform (iOS: () => {
+ if (Device.Idiom == TargetIdiom.Tablet) {
+ Padding = new Thickness (0, 0, 0, 60);
+ }
+ });
+
+ var stack = new StackLayout { Orientation = StackOrientation.Vertical };
+ Button b1 = new Button { Text = "Boring", HeightRequest = 500, MinimumHeightRequest = 50 };
+ Button b2 = new Button {
+ Text = "Exciting!",
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.CenterAndExpand
+ };
+ Button b3 = new Button { Text = "Amazing!", VerticalOptions = LayoutOptions.FillAndExpand };
+ Button b4 = new Button { Text = "Meh", HeightRequest = 400, MinimumHeightRequest = 50 };
+ b1.Clicked += (sender, e) => {
+ b1.Text = "clicked1";
+ };
+ b2.Clicked += (sender, e) => {
+ b2.Text = "clicked2";
+ };
+ b3.Clicked += (sender, e) => {
+ b3.Text = "clicked3";
+ };
+ b4.Clicked += (sender, e) => {
+ b4.Text = "clicked4";
+ };
+ stack.Children.Add (b1);
+ stack.Children.Add (b2);
+ stack.Children.Add (b3);
+ stack.Children.Add (b4);
+ Content = stack;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/StepperGallery.cs b/Xamarin.Forms.Controls/GalleryPages/StepperGallery.cs
new file mode 100644
index 0000000..6da9bba
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/StepperGallery.cs
@@ -0,0 +1,49 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ public class StepperGallery : ContentPage
+ {
+ public StepperGallery ()
+ {
+ var stepper = new Stepper {
+ Minimum = 0,
+ Maximum = 100,
+ Increment = 10
+ };
+
+ var label = new Label {
+ Text = stepper.Value.ToString()
+ };
+
+ stepper.ValueChanged += (s, e) => {
+ label.Text = e.NewValue.ToString();
+ };
+
+ var stepperTwo = new Stepper {
+ Minimum = 0.0,
+ Maximum = 1.0,
+ Increment = 0.05
+ };
+
+ var labelTwo = new Label {
+ Text = stepperTwo.Value.ToString ()
+ };
+
+ stepperTwo.ValueChanged += (s, e) => {
+ labelTwo.Text = e.NewValue.ToString ();
+ };
+
+ Content = new StackLayout {
+ Padding = new Thickness (20),
+ Children = {
+ stepper,
+ label,
+ stepperTwo,
+ labelTwo
+ }
+ };
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/StyleGallery.cs b/Xamarin.Forms.Controls/GalleryPages/StyleGallery.cs
new file mode 100644
index 0000000..6ae2d84
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/StyleGallery.cs
@@ -0,0 +1,41 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ public class StyleGallery:ContentPage
+ {
+ public StyleGallery ()
+ {
+ Content = new StackLayout {
+ Children = {
+ new Label {
+ Text = "This uses TitleStyle",
+ Style = Device.Styles.TitleStyle
+ },
+ new Label {
+ Text = "This uses SubtitleStyle",
+ Style = Device.Styles.SubtitleStyle
+ },
+ new Label {
+ Text = "This uses BodyStyle",
+ Style = Device.Styles.BodyStyle
+ },
+ new Label {
+ Text = "This uses CaptionStyle",
+ Style = Device.Styles.CaptionStyle
+ },
+ new Label {
+ Text = "This uses a custom style inherited dynamically from SubtitleStyle",
+ Style = new Style (typeof(Label)) {
+ BaseResourceKey = Device.Styles.SubtitleStyleKey,
+ Setters = {
+ new Setter {Property = Label.TextColorProperty, Value = Color.Pink}
+ }
+ }
+ },
+ }
+ };
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml b/Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml
new file mode 100644
index 0000000..524db15
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Controls.StyleXamlGallery">
+<ContentPage.Resources>
+ <ResourceDictionary>
+ <Style x:Key="customStyle" TargetType="Label" BaseResourceKey="SubtitleStyle">
+ <Setter Property="Label.TextColor" Value="Color.Pink"/>
+ </Style>
+ </ResourceDictionary>
+</ContentPage.Resources>
+ <StackLayout>
+ <Label Text="This uses TitleStyle" Style="{DynamicResource TitleStyle}"/>
+ <Label Text="This uses SubtitleStyle" Style="{DynamicResource SubtitleStyle}"/>
+ <Label Text="This uses BodyStyle" Style="{DynamicResource BodyStyle}"/>
+ <Label Text="This uses CaptionStyle" Style="{DynamicResource CaptionStyle}"/>
+ <Label Text="This uses a custom style inherited from SubtitleStyle" Style="{StaticResource customStyle}"/>
+ </StackLayout>
+</ContentPage>
diff --git a/Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml.cs b/Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml.cs
new file mode 100644
index 0000000..3983722
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/StyleXamlGallery.xaml.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ public partial class StyleXamlGallery : ContentPage
+ {
+ public StyleXamlGallery ()
+ {
+ InitializeComponent ();
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/SwitchGallery.cs b/Xamarin.Forms.Controls/GalleryPages/SwitchGallery.cs
new file mode 100644
index 0000000..efdf623
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/SwitchGallery.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class SwitchGallery : ContentPage
+ {
+ public SwitchGallery ()
+ {
+ var testLabel = new Label {
+ Text = "Test Label"
+ };
+
+ var normal = new Switch { IsToggled = true };
+ var disabled = new Switch ();
+ var transparent = new Switch ();
+ var stepper = new Stepper ();
+
+ normal.Toggled += (sender, e) => {
+ testLabel.Text = "Toggled normal switch";
+ };
+
+ disabled.Toggled += (sender, e) => {
+ testLabel.Text = "Toggled disabled switch (magic)";
+ };
+
+ transparent.Toggled += (sender, e) => {
+ testLabel.Text = "Toggled transparent switch";
+ };
+
+ stepper.ValueChanged += (sender, e) => {
+ testLabel.Text = stepper.Value.ToString ();
+ };
+
+ disabled.IsEnabled = false;
+ transparent.Opacity = 0.5;
+
+ Content = new StackLayout {
+ Padding = new Thickness (20),
+ Children = {
+ testLabel,
+ normal,
+ disabled,
+ transparent,
+ stepper,
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/TableViewGallery.cs b/Xamarin.Forms.Controls/GalleryPages/TableViewGallery.cs
new file mode 100644
index 0000000..92e5c1c
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/TableViewGallery.cs
@@ -0,0 +1,24 @@
+namespace Xamarin.Forms.Controls
+{
+ internal class TableViewGallery : ContentPage
+ {
+ public TableViewGallery () {
+
+ var section = new TableSection ("Section One") {
+ new ViewCell { View = new Label { Text = "View Cell 1" } },
+ new ViewCell { View = new Label { Text = "View Cell 2" } }
+ };
+
+ var root = new TableRoot ("Table") {
+ section
+ };
+
+ var tableLayout = new TableView {
+ Root = root,
+ RowHeight = 100
+ };
+
+ Content = tableLayout;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/TemplatedCarouselGallery.cs b/Xamarin.Forms.Controls/GalleryPages/TemplatedCarouselGallery.cs
new file mode 100644
index 0000000..2d9cfe1
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/TemplatedCarouselGallery.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.ObjectModel;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class TemplatedCarouselGallery
+ : CarouselPage
+ {
+ ObservableCollection<Item> _items;
+ int _count = 0;
+
+ public TemplatedCarouselGallery()
+ {
+ NavigationPage.SetHasNavigationBar (this, false);
+
+ _items = new ObservableCollection<Item> {
+ CreateItem(),
+ CreateItem(),
+ };
+
+ ItemsSource = _items;
+
+ ItemTemplate = new DataTemplate (() => {
+ var page = new ContentPage ();
+
+ page.Padding = new Thickness (0,30,0,0);
+ page.SetBinding (TitleProperty, "Title");
+
+ var layout = new StackLayout { Spacing = 0 };
+
+ var label = new Label();
+ label.SetBinding (Label.TextProperty, "Content");
+ layout.Children.Add (label);
+
+ var swipeHereLabel = new Label {
+ Text = "Swipe Here",
+ HeightRequest = 40
+ };
+
+ layout.Children.Add (swipeHereLabel);
+
+ var add = new Button ();
+ add.SetBinding (Button.TextProperty, "InsertTabText");
+ add.Clicked += (sender, args) => _items.Insert (_items.IndexOf ((Item)add.BindingContext) + 1, CreateItem());
+ layout.Children.Add (add);
+
+ var change = new Button ();
+ change.SetBinding (Button.TextProperty, "ChangeTitleText");
+ change.Clicked += (sender, args) => ((Item) change.BindingContext).Title = (new Random().Next().ToString());
+ layout.Children.Add (change);
+
+ var remove = new Button ();
+ remove.SetBinding (Button.TextProperty, "RemoveTabText");
+ remove.Clicked += (sender, args) => _items.Remove ((Item)remove.BindingContext);
+ layout.Children.Add (remove);
+
+ var reset = new Button ();
+ reset.SetBinding (Button.TextProperty, "ResetAllTabsText");
+ reset.Clicked += (sender, args) => {
+ _count = 0;
+ ItemsSource = _items = new ObservableCollection<Item> { CreateItem(), CreateItem() };
+ };
+ layout.Children.Add (reset);
+
+ var nextPage = new Button ();
+ nextPage.SetBinding (Button.TextProperty, "NextPageText");
+ nextPage.Clicked += (sender, args) => {
+ int index = _items.IndexOf ((Item) nextPage.BindingContext) + 1;
+ if (index == _items.Count)
+ index = 0;
+
+ SelectedItem = _items[index];
+ };
+ layout.Children.Add (nextPage);
+
+ var delayReset = new Button { Text = "Delayed reset" };
+ delayReset.SetBinding (Button.TextProperty, "DelayedResetText");
+ delayReset.Clicked += (sender, args) => {
+ ItemsSource = null;
+
+ Task.Delay (5000).ContinueWith (t => {
+ _count = 0;
+ ItemsSource = _items = new ObservableCollection<Item> { CreateItem(), CreateItem() };
+ }, TaskScheduler.FromCurrentSynchronizationContext());
+ };
+
+ layout.Children.Add (delayReset);
+
+ page.Content = new ScrollView {
+ Padding = new Thickness (60, 0),
+ Content = layout
+ };
+ return page;
+ });
+ }
+
+ Item CreateItem()
+ {
+ int x = _count++;
+ return new Item {
+ Title = "Page " + x,
+ Content = "Lorem ipsum dolor sit amet #" + x,
+ InsertTabText = "Insert Tab: " + x,
+ ChangeTitleText = "Change title: " + x,
+ MoveTabText = "Move Tab: " + x,
+ RemoveTabText = "Remove Tab: " + x,
+ ResetAllTabsText = "Reset all tabs: " + x,
+ NextPageText = "Next Page: " + x,
+ DelayedResetText = "Delayed reset: " + x
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/TemplatedTabbedGallery.cs b/Xamarin.Forms.Controls/GalleryPages/TemplatedTabbedGallery.cs
new file mode 100644
index 0000000..014b77e
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/TemplatedTabbedGallery.cs
@@ -0,0 +1,169 @@
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ internal class Item
+ : INotifyPropertyChanged
+ {
+ string _title;
+ string _content;
+ public string InsertTabText { get; set; }
+ public string ChangeTitleText { get; set; }
+ public string MoveTabText { get; set; }
+ public string RemoveTabText { get; set; }
+ public string ResetAllTabsText { get; set; }
+ public string NextPageText { get; set; }
+ public string DelayedResetText { get; set; }
+
+ public string Icon { get; set; }
+
+ public string Title
+ {
+ get { return _title; }
+ set
+ {
+ if (_title == value)
+ return;
+
+ _title = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public string Content
+ {
+ get { return _content; }
+ set
+ {
+ if (_content == value)
+ return;
+
+ _content = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged ([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null)
+ handler (this, new PropertyChangedEventArgs (propertyName));
+ }
+ }
+
+ internal class TemplatedTabbedGallery : TabbedPage
+ {
+ ObservableCollection<Item> _items;
+ int _count = 0;
+
+ public TemplatedTabbedGallery()
+ {
+ Title = "Templated Tabbed Gallery";
+ _items = new ObservableCollection<Item> {
+ CreateItem(),
+ CreateItem()
+ };
+
+ ItemsSource = _items;
+
+ ItemTemplate = new DataTemplate (() => {
+ var page = new ContentPage();
+ page.SetBinding (TitleProperty, "Title");
+ page.SetBinding (IconProperty, "Icon");
+
+ var layout = new StackLayout();
+
+ var label = new Label();
+ label.SetBinding (Label.TextProperty, "Content");
+ layout.Children.Add (label);
+
+ var add = new Button ();
+ add.SetBinding (Button.TextProperty, "InsertTabText");
+ add.Clicked += (sender, args) => _items.Insert (_items.IndexOf ((Item)add.BindingContext) + 1, CreateItem());
+ layout.Children.Add (add);
+
+ var titleNum = 0;
+ var change = new Button ();
+ change.SetBinding (Button.TextProperty, "ChangeTitleText");
+ change.Clicked += (sender, args) => ((Item) change.BindingContext).Title = ("Title: " + titleNum++);
+ layout.Children.Add (change);
+
+ var move = new Button ();
+ move.SetBinding (Button.TextProperty, "MoveTabText");
+ move.Clicked += (sender, args) => {
+ int originalIndex = _items.IndexOf ((Item) add.BindingContext);
+ int index = originalIndex + 1;
+ if (index == _items.Count)
+ index = 0;
+
+ _items.Move (originalIndex, index);
+ };
+ layout.Children.Add (move);
+
+ var remove = new Button ();
+ remove.SetBinding (Button.TextProperty, "RemoveTabText");
+ remove.Clicked += (sender, args) => {
+ if (_items.Count == 0) {
+ layout.Children.Add (new Label {
+ Text = "No more tabs"
+ });
+ }
+ _items.Remove ((Item)remove.BindingContext);
+ };
+ layout.Children.Add (remove);
+
+ var reset = new Button ();
+ reset.SetBinding (Button.TextProperty, "ResetAllTabsText");
+ reset.Clicked += (sender, args) => {
+ _count = 0;
+ ItemsSource = _items = new ObservableCollection<Item> { CreateItem(), CreateItem() };
+ };
+ layout.Children.Add (reset);
+
+ var nextPage = new Button ();
+ nextPage.SetBinding (Button.TextProperty, "NextPageText");
+ nextPage.Clicked += (sender, args) => {
+ int index = _items.IndexOf ((Item) nextPage.BindingContext) + 1;
+ if (index == _items.Count)
+ index = 0;
+
+ SelectedItem = _items[index];
+ };
+ layout.Children.Add (nextPage);
+
+ page.Content = new ScrollView {
+ Padding = new Thickness (20, 0),
+ Content = layout
+ };
+
+ return page;
+ });
+ }
+
+ Item CreateItem()
+ {
+ int x = _count++;
+ var item = new Item {
+ Title = "Page " + x,
+ Content = "Lorem ipsum dolor sit amet #" + x ,
+ InsertTabText = "Insert Tab: " + x,
+ ChangeTitleText = "Change title: " + x,
+ MoveTabText = "Move Tab: " + x,
+ RemoveTabText = "Remove Tab: " + x,
+ ResetAllTabsText = "Reset all tabs: " + x,
+ NextPageText = "Next Page: " + x
+ };
+
+ if (x == 0)
+ item.Icon = "bank.png";
+
+ return item;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/ToolbarGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ToolbarGallery.cs
new file mode 100644
index 0000000..b2be5f0
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ToolbarGallery.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ToolbarGallery : ContentPage
+ {
+ readonly Toolbar _toolbar;
+ readonly StackLayout _stack;
+
+ public ToolbarGallery ()
+ {
+ var label = new Label {
+ Text = "Click the toolbar"
+ };
+
+ Content = _stack = new StackLayout ();
+ _stack.Children.Add (label);
+
+ foreach (string name in new[] { "One", "Two", "Three", "Four" }) {
+ var toolbarItem = new ToolbarItem (name, null, delegate {
+ label.Text = "Activated: " + name;
+ }, ToolbarItemOrder.Secondary);
+ ToolbarItems.Add (toolbarItem);
+ }
+
+ var imagePrimaryItem = new ToolbarItem (null, "menuIcon.png", () => label.Text = "Activated: Primary Image 1", ToolbarItemOrder.Primary);
+ var imagePrimaryItemWithTitle = new ToolbarItem ("Primary", "menuIcon.png", () => label.Text = "Activated: Primary Image 2", ToolbarItemOrder.Primary);
+ var imageItem = new ToolbarItem (null, "seth.png", () => label.Text = "Activated: Secondary Image 1", ToolbarItemOrder.Secondary);
+ var imageItemWithTitle = new ToolbarItem ("Secondary", "seth.png", () => label.Text = "Activated: Secondary Image 2", ToolbarItemOrder.Secondary);
+ ToolbarItems.Add (imagePrimaryItem);
+ ToolbarItems.Add (imagePrimaryItemWithTitle);
+ ToolbarItems.Add (imageItem);
+ ToolbarItems.Add (imageItemWithTitle);
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/UnevenListGallery.cs b/Xamarin.Forms.Controls/GalleryPages/UnevenListGallery.cs
new file mode 100644
index 0000000..1c8b16c
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/UnevenListGallery.cs
@@ -0,0 +1,112 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class UnevenListGallery : ContentPage
+ {
+ public UnevenListGallery ()
+ {
+ Padding = new Thickness (0, 20, 0, 0);
+
+ var list = new ListView {
+ HasUnevenRows = true
+ };
+
+ bool next = true;
+ list.ItemTemplate = new DataTemplate (() => {
+ bool tall = next;
+ next = !next;
+
+ var cell = new TextCell {
+ Height = (tall) ? 88 : 44
+ };
+
+ cell.SetBinding (TextCell.TextProperty, ".");
+ return cell;
+ });
+
+ list.ItemsSource = new[] { "Tall", "Short", "Tall", "Short" };
+
+ var listViewCellDynamicHeight = new ListView {
+ HasUnevenRows = true,
+ AutomationId= "unevenCellListGalleryDynamic"
+ };
+
+ listViewCellDynamicHeight.ItemsSource = new [] {
+ @"That Flesh is heir to? 'Tis a consummation
+Devoutly to be wished. To die, to sleep,
+To sleep, perchance to Dream; Aye, there's the rub,
+For in that sleep of death, what dreams may come,That Flesh is heir to? 'Tis a consummation
+Devoutly to be wished. To die, to sleep,
+To sleep, perchance to Dream; Aye, there's the rub,
+For in that sleep of death, what dreams may come",
+ };
+
+ listViewCellDynamicHeight.ItemTemplate = new DataTemplate (typeof(UnevenRowsCell));
+
+ listViewCellDynamicHeight.ItemTapped += (sender, e) => {
+ if (e == null)
+ return; // has been set to null, do not 'process' tapped event
+ ((ListView)sender).SelectedItem = null; // de-select the row
+ };
+
+ var grd = new Grid ();
+
+ grd.RowDefinitions.Add (new RowDefinition ());
+ grd.RowDefinitions.Add (new RowDefinition ());
+
+ grd.Children.Add (listViewCellDynamicHeight);
+ grd.Children.Add (list);
+
+ Grid.SetRow (list, 1);
+
+ Content = grd;
+ }
+
+ public class UnevenRowsCell : ViewCell
+ {
+ public UnevenRowsCell ()
+ {
+ var label1 = new Label {
+ Text = "Label 1",
+ FontSize = Device.GetNamedSize (NamedSize.Small, typeof(Label))
+ };
+ label1.SetBinding (Label.TextProperty, new Binding ("."));
+
+ View = new StackLayout {
+ Orientation = StackOrientation.Vertical,
+ VerticalOptions = LayoutOptions.StartAndExpand,
+ Padding = new Thickness (15, 5, 5, 5),
+ Children = { label1 }
+ };
+ }
+ // This is the code used before and still works by setting the height of the cell
+ // const int avgCharsInRow = 35;
+ // const int defaultHeight = 44;
+ // const int extraLineHeight = 20;
+ // protected override void OnBindingContextChanged ()
+ // {
+ // base.OnBindingContextChanged ();
+ //
+ // if (Device.OS == TargetPlatform.iOS) {
+ // var text = (string)BindingContext;
+ //
+ // var len = text.Length;
+ //
+ // if (len < (avgCharsInRow * 2)) {
+ // // fits in one cell
+ // Height = defaultHeight;
+ // } else {
+ // len = len - (avgCharsInRow * 2);
+ // var extraRows = len / 35;
+ // Height = defaultHeight + extraRows * extraLineHeight;
+ // }
+ // }
+ // }
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/WebViewGallery.cs b/Xamarin.Forms.Controls/GalleryPages/WebViewGallery.cs
new file mode 100644
index 0000000..c39e777
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/WebViewGallery.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class WebViewGallery : ContentPage
+ {
+ class ViewModel
+ {
+ public string Html { get; set; } = "<html><body><p>This is a WebView!</p></body></html>";
+
+ public string Url { get; set; } = "http://xamarin.com";
+
+ }
+
+ public WebViewGallery ()
+ {
+ var htmlWebView = new WebView {
+ HeightRequest = 40,
+ //Source = new HtmlWebViewSource {Html ="<html><body><p>This is a WebView!</p></body></html>"}
+ };
+ var urlWebView = new WebView {
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ //Source = new UrlWebViewSource {Url = "http://xamarin.com/"}
+ };
+
+ var htmlSource = new HtmlWebViewSource ();
+ htmlSource.SetBinding (HtmlWebViewSource.HtmlProperty, "HTML");
+ htmlWebView.Source = htmlSource;
+
+ var urlSource = new UrlWebViewSource ();
+ urlSource.SetBinding (UrlWebViewSource.UrlProperty, "URL");
+ urlWebView.Source = urlSource;
+
+ var viewModel = new ViewModel ();
+ BindingContext = viewModel;
+
+ Content = new StackLayout {
+ Padding = new Size (20, 20),
+ Children = {
+ htmlWebView,
+ urlWebView
+ }
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml b/Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml
new file mode 100644
index 0000000..bbd6e33
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Controls.XamlPage">
+ <Label Text="Hello, Xaml" VerticalOptions="Center" HorizontalOptions="CenterAndExpand"/>
+</ContentPage>
diff --git a/Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml.cs b/Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml.cs
new file mode 100644
index 0000000..636ef60
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/XamlPage.xaml.cs
@@ -0,0 +1,13 @@
+using Xamarin.Forms;
+
+namespace Xamarin.Forms.Controls
+{
+ public partial class XamlPage : ContentPage
+ {
+ public XamlPage ()
+ {
+ InitializeComponent ();
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/GalleryPages/crimson.jpg b/Xamarin.Forms.Controls/GalleryPages/crimson.jpg
new file mode 100644
index 0000000..3db7bb2
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/crimson.jpg
Binary files differ
diff --git a/Xamarin.Forms.Controls/Helpers/ITestCloudService.cs b/Xamarin.Forms.Controls/Helpers/ITestCloudService.cs
new file mode 100644
index 0000000..4187536
--- /dev/null
+++ b/Xamarin.Forms.Controls/Helpers/ITestCloudService.cs
@@ -0,0 +1,12 @@
+namespace Xamarin.Forms.Controls
+{
+ public interface ITestCloudService
+ {
+ bool IsOnTestCloud ();
+
+ string GetTestCloudDeviceName ();
+
+ string GetTestCloudDevice ();
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml
new file mode 100644
index 0000000..52990d9
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:CustomViewCell="clr-namespace:App2;assembly=Xamarin.Forms.Controls"
+ x:Class="App2.Page1">
+ <ListView x:Name="itemListView" RowHeight="75" HeightRequest="700" SeparatorColor="#061018" BackgroundColor="Blue" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <CustomViewCell:SampleViewCell />
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs
new file mode 100644
index 0000000..8bed277
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs
@@ -0,0 +1,193 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using Xamarin.Forms;
+
+namespace App2
+{
+ public partial class Page1 : ContentPage
+ {
+ public Page1()
+ {
+ InitializeComponent();
+
+ ObservableCollection<CheckListDetails> objlist = new ObservableCollection<CheckListDetails>();
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "", ChecklistStatus = CheckListStatus.Default });
+
+
+ itemListView.ItemsSource = objlist;
+ }
+ }
+
+ public class CheckListDetails
+ {
+ string _callout;
+ string _action;
+ string _currentStatusD;
+
+ CheckListStatus _checklistStatus = CheckListStatus.Default;
+
+ public CheckListDetails()
+ {
+ _currentStatusD = string.Empty;
+ }
+
+ public CheckListStatus ChecklistStatus
+ {
+ get { return _checklistStatus; }
+ set
+ {
+ if (value == CheckListStatus.Default)
+ {
+
+ }
+
+ SetProperty(ref _checklistStatus, value);
+ }
+ }
+
+ public string CurrentStatusD
+ {
+ get { return _currentStatusD; }
+ set { SetProperty(ref _currentStatusD, value); }
+ }
+
+ public string Action
+ {
+ get { return _action; }
+ set { SetProperty(ref _action, value); }
+ }
+
+ public string CallOut
+ {
+ get { return _callout; }
+ set { SetProperty(ref _callout, value); }
+ }
+
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+ {
+ if (Equals(storage, value))
+ {
+ return false;
+ }
+
+ storage = value;
+ OnPropertyChanged(propertyName);
+ return true;
+ }
+
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ var handler = PropertyChanged;
+
+ if (handler != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ public enum CheckListStatus
+ {
+ Default,
+ Completed,
+ Pending,
+ OverRide
+ }
+}
diff --git a/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml
new file mode 100644
index 0000000..f360b4d
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="App2.SampleViewCell">
+ <ViewCell.View>
+ <Grid x:Name="OuterGrid" HeightRequest="75" HorizontalOptions="FillAndExpand" VerticalOptions="Start" BackgroundColor="Red" Padding="20,0,30,0">
+ <!--<Grid.Resources>
+ <ResourceDictionary>
+ <FormsLib:StringToColorConverter x:Key="StringToColorConverter" />
+ </ResourceDictionary>
+ </Grid.Resources>-->
+ <Grid.GestureRecognizers>
+ <TapGestureRecognizer Tapped="Checklist_tapped" />
+ </Grid.GestureRecognizers>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="50" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Image x:Name="completedimg" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="0" IsVisible="true"/>
+
+ <Label Text="{Binding CallOut}" TextColor="Yellow" FontSize="17" FontFamily="Roboto" XAlign="Start" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="1" />
+ <Label Text="........................................................................................................................................................................." LineBreakMode ="NoWrap" TextColor="Yellow" HorizontalOptions="FillAndExpand" VerticalOptions="Center" Grid.Row="0" Grid.Column="2" />
+ <Label Text="{Binding Action}" FontSize="17" TextColor="Yellow" FontFamily="Roboto" XAlign="End" HorizontalOptions="End" VerticalOptions="Center" Grid.Row="0" Grid.Column="3" />
+
+ </Grid>
+
+ </ViewCell.View>
+</ViewCell> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs
new file mode 100644
index 0000000..f7808d1
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs
@@ -0,0 +1,149 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xamarin.Forms;
+
+
+namespace App2
+{
+
+ public partial class SampleViewCell : ViewCell
+ {
+ MenuItem _overRideItemmenuitem = null;
+ public SampleViewCell()
+ {
+ try
+ {
+ InitializeComponent();
+
+ _overRideItemmenuitem = new MenuItem();
+ _overRideItemmenuitem.Text = "Over Ride";
+ _overRideItemmenuitem.IsDestructive = true;
+ _overRideItemmenuitem.Clicked += OverRide_Clicked;
+
+ //this.ContextActions.Add(OverRideItemmenuitem);
+
+ //Height = 300;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ void OverRide_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ var obj = (CheckListDetails)((MenuItem)sender).BindingContext;
+ obj.ChecklistStatus = CheckListStatus.OverRide;
+
+ SetContextActions();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ void Checklist_tapped(object sender, EventArgs e)
+ {
+ try
+ {
+ var selectItem = (CheckListDetails)((Grid)sender).BindingContext;
+
+ if (selectItem != null && selectItem.ChecklistStatus != CheckListStatus.OverRide)
+ {
+ selectItem.ChecklistStatus = CheckListStatus.Completed;
+
+ SetContextActions();
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ //protected override void OnPropertyChanged(string propertyName = null)
+ //{
+ // base.OnPropertyChanged(propertyName);
+ // if(propertyName == ViewCell.BindingContextProperty.PropertyName)
+ // {
+ // setContextActions();
+ // }
+ //}
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+ SetContextActions();
+ }
+
+ void SetContextActions()
+ {
+ try
+ {
+ if (BindingContext != null)
+ {
+ var obj = (CheckListDetails)BindingContext;
+
+ if (obj.ChecklistStatus == CheckListStatus.Default)
+ {
+ if (ContextActions.Count == 0)
+ {
+ ContextActions.Add(_overRideItemmenuitem);
+ }
+ }
+ else if (obj.ChecklistStatus == CheckListStatus.Completed)
+ {
+ if (ContextActions.Count > 0)
+ {
+
+ ContextActions.Remove(_overRideItemmenuitem);
+ if (_overRideItemmenuitem != null)
+ {
+ _overRideItemmenuitem.Clicked -= OverRide_Clicked;
+ _overRideItemmenuitem = null;
+ }
+ }
+
+
+ }
+ else if (obj.ChecklistStatus == CheckListStatus.Pending)
+ {
+ if (ContextActions.Count == 0)
+ {
+ ContextActions.Add(_overRideItemmenuitem);
+ }
+
+
+ }
+ else if (obj.ChecklistStatus == CheckListStatus.OverRide)
+ {
+ if (ContextActions.Count > 0)
+ {
+ ContextActions.Remove(_overRideItemmenuitem);
+ if (_overRideItemmenuitem != null)
+ {
+ _overRideItemmenuitem.Clicked -= OverRide_Clicked;
+ _overRideItemmenuitem = null;
+ }
+
+ }
+ }
+
+ }
+
+
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ }
+}
diff --git a/Xamarin.Forms.Controls/Properties/AssemblyInfo.cs b/Xamarin.Forms.Controls/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..2a99acb
--- /dev/null
+++ b/Xamarin.Forms.Controls/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Xamarin.Forms.Controls")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Xamarin Inc.")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("Xamarin Inc.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
+[assembly: InternalsVisibleTo ("Xamarin.Forms.Core.WP8")]
+
+// The control gallary needs to add code references to internals to prevent the linker from
+// removing the references. Remove this once the [PreserveAttribute] can be applied at the class
+// and member level.
+[assembly: InternalsVisibleTo ("Xamarin.Forms.ControlGallery.Android")]
diff --git a/Xamarin.Forms.Controls/RootPages/CaseTenPage.cs b/Xamarin.Forms.Controls/RootPages/CaseTenPage.cs
new file mode 100644
index 0000000..98527c4
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/CaseTenPage.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // May not behave
+ // NavigationPage with multiple tabbed pages
+ public class CaseTenPage : MasterDetailPage
+ {
+ public CaseTenPage ()
+ {
+ var btn = new Button {Text = "Click Me"};
+ btn.Clicked += (sender, args) => btn.Navigation.PushModalAsync (new NavigationPage (new ContentPage ()));
+
+ var detail = new ContentPage {Content = btn};
+
+ NavigationPage.SetHasNavigationBar (detail, false);
+
+ Master = new ListPage (){Title = "Master"};
+ Detail = detail;
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/Issue465Page.cs b/Xamarin.Forms.Controls/RootPages/Issue465Page.cs
new file mode 100644
index 0000000..84cfa95
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/Issue465Page.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ //Issue 465
+ public class Issue465Page : TabbedPage
+ {
+ public Issue465Page ()
+ {
+ var popModalButton = new Button {
+ Text = "PopModalAsync",
+ HorizontalOptions = LayoutOptions.CenterAndExpand,
+ VerticalOptions = LayoutOptions.CenterAndExpand
+ };
+ var splashPage = new ContentPage { Content = popModalButton };
+
+ Navigation.PushModalAsync (splashPage);
+
+ popModalButton.Clicked += (s, e) => Navigation.PopModalAsync ();
+
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootContentPage.cs
new file mode 100644
index 0000000..0e4e004
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootContentPage.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+
+ public class RootContentPage : ContentPage
+ {
+ public RootContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+ Content = new SwapHierachyStackLayout (hierarchy);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootMDPNavigationContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootMDPNavigationContentPage.cs
new file mode 100644
index 0000000..2a7de4b
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootMDPNavigationContentPage.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ //MasterDetailPage -> NavigationPage -> ContentPage
+ public class RootMDPNavigationContentPage : MasterDetailPage
+ {
+
+ public RootMDPNavigationContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ Master = new ContentPage {
+ Title = "Testing 123",
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Master" },
+ new AbsoluteLayout {
+ BackgroundColor = Color.Red,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ },
+ new Button { Text = "Button" }
+ }
+ }
+ };
+
+ Detail = new NavigationPage (new ContentPage {
+ Title = "Md->Nav->Con",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ });
+
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/RootPages/RootMDPNavigationTabbedContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootMDPNavigationTabbedContentPage.cs
new file mode 100644
index 0000000..096b776
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootMDPNavigationTabbedContentPage.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // MasterDetailPage -> NavigationPage -> TabbedPage -> ContentPage
+ public class RootMDPNavigationTabbedContentPage : MasterDetailPage {
+
+ public RootMDPNavigationTabbedContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+
+ var tabbedPage = new TabbedPage ();
+
+ var firstTab = new ContentPage {
+ //BackgroundColor = Color.Yellow,
+ Title = "Testing 123",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ };
+
+ tabbedPage.Children.Add (firstTab);
+
+ NavigationPage.SetHasNavigationBar (firstTab, false);
+
+ Detail = new NavigationPage (tabbedPage);
+ Master = new NavigationPage (new ContentPage {
+ Title = "Testing 345",
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Hello" },
+ new AbsoluteLayout {
+ BackgroundColor = Color.Red,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ },
+ new Button { Text = "Button" }
+ }
+ }
+ }) {
+ Title = "Testing 345"
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/RootPages/RootNavigationContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootNavigationContentPage.cs
new file mode 100644
index 0000000..8a3d450
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootNavigationContentPage.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // NavigationPage -> ContentPage
+ public class RootNavigationContentPage : NavigationPage {
+
+ public RootNavigationContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var content = new ContentPage {
+ BackgroundColor = Color.Yellow,
+ Title = "Testing 123",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ };
+
+ PushAsync (content);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootNavigationManyTabbedPage.cs b/Xamarin.Forms.Controls/RootPages/RootNavigationManyTabbedPage.cs
new file mode 100644
index 0000000..fdce27d
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootNavigationManyTabbedPage.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // May not behave
+ // NavigationPage with multiple tabbed pages
+ public class RootNavigationManyTabbedPage : NavigationPage
+ {
+ public RootNavigationManyTabbedPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var content = new TabbedPage {
+ Children = {
+ new ContentPage {
+ Title = "Page 1",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ },
+ new ContentPage {
+ Title = "Page 2",
+ Content = new Label {
+ Text = "Page 2"
+ }
+ },
+ new ContentPage {
+ Title = "Page 3",
+ Content = new Label {
+ Text = "Page 3"
+ }
+ },
+ new ContentPage {
+ Title = "Page 4",
+ Content = new Label {
+ Text = "Page 4"
+ }
+ },
+ new ContentPage {
+ Title = "Page 5",
+ Content = new Label {
+ Text = "Page 5"
+ }
+ },
+ new ContentPage {
+ Title = "Page 6",
+ Content = new Label {
+ Text = "Page 6"
+ }
+ },
+
+ new ContentPage {
+ Title = "Go Home",
+ },
+ }
+ };
+ PushAsync (content);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootNavigationTabbedContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootNavigationTabbedContentPage.cs
new file mode 100644
index 0000000..25c2987
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootNavigationTabbedContentPage.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // NavigationPage -> TabbedPage -> ContentPage
+ // Not recommended
+ public class RootNavigationTabbedContentPage : NavigationPage
+ {
+ public RootNavigationTabbedContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var tabbedPage = new TabbedPage {
+ Children = {
+ new ContentPage {
+ Title = "Page 1",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ },
+ new ContentPage {
+ Title = "Page 2",
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Page Two" },
+ new BoxView {
+ Color = Color.Gray,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ },
+ new Button { Text = "Click me" },
+ }
+ }
+ }
+ }
+ };
+
+ PushAsync (tabbedPage);
+ }
+
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootTabbedContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootTabbedContentPage.cs
new file mode 100644
index 0000000..fdcfb92
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootTabbedContentPage.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // TabbedPage -> ContentPage
+ public class RootTabbedContentPage : TabbedPage
+ {
+ public RootTabbedContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var tabOne = new ContentPage {
+ Title = "Testing 123",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ };
+
+ var tabTwo = new ContentPage {
+ Title = "Testing 345",
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Hello" },
+ new AbsoluteLayout {
+ BackgroundColor = Color.Red,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ },
+ new Button { Text = "Button" },
+ }
+ }
+ };
+
+ Children.Add (tabOne);
+ Children.Add (tabTwo);
+
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/RootPages/RootTabbedMDPNavigationContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootTabbedMDPNavigationContentPage.cs
new file mode 100644
index 0000000..14bf7cf
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootTabbedMDPNavigationContentPage.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ //TabbedPage -> MasterDetailPage -> NavigationPage -> ContentPage
+ public class RootTabbedMDPNavigationContentPage : TabbedPage
+ {
+ public RootTabbedMDPNavigationContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var tabOne = new MasterDetailPage {
+ Title = "Testing 123",
+ Master = new ContentPage {
+ Title = "Testing 123",
+ Content = new StackLayout {
+ Children = {
+ new Label {Text = "Master"},
+ new AbsoluteLayout {
+ BackgroundColor = Color.Red,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ },
+ new Button {Text = "Button"}
+ }
+ }
+ },
+ Detail = new NavigationPage (new ContentPage {
+ Title = "Testing 123",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ })
+ };
+
+ var tabTwo = new ContentPage {
+ Title = "Testing 345",
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Hello" },
+ new AbsoluteLayout {
+ BackgroundColor = Color.Red,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ }
+ }
+ }
+ };
+
+ Children.Add (tabOne);
+ Children.Add (tabTwo);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootTabbedManyNavigationContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootTabbedManyNavigationContentPage.cs
new file mode 100644
index 0000000..e0a565a
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootTabbedManyNavigationContentPage.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+
+ public class RootTabbedManyNavigationContentPage : TabbedPage
+ {
+ public RootTabbedManyNavigationContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var page1 = new NavigationPage (new ContentPage {
+ Content = new SwapHierachyStackLayout (hierarchy)
+ }) {Title = "P 1"};
+
+ var page2 = new NavigationPage (new ContentPage {
+ Title = "Page 2",
+ Content = new Label {
+ Text = "Page 2"
+ }
+ }) {Title = "P 2"};
+
+ var page3 = new NavigationPage (new ContentPage {
+ Title = "Page 3",
+ Content = new Label {
+ Text = "Page 3"
+ }
+
+ }) {Title = "P 3"};
+
+ var page4 = new NavigationPage (new ContentPage {
+ Title = "Page 4",
+ Content = new Label {
+ Text = "Page 4"
+ }
+
+ }) {Title = "P 4"};
+
+ var page5 = new NavigationPage (new ContentPage {
+ Title = "Page 5",
+ Content = new Label {
+ Text = "Page 5"
+ }
+
+ }) {Title = "P 5"};
+
+ var page6 = new NavigationPage (new ContentPage {
+ Title = "Page 6",
+ Content = new Label {
+ Text = "Page 6"
+ }
+
+ }) {Title = "P 6"};
+
+ var page7 = new NavigationPage (new ContentPage {
+ Title = "Page 7",
+ Content = new Label {
+ Text = "Page 7"
+ }
+
+ }) {Title = "Home"};
+
+ Children.Add (page1);
+ Children.Add (page2);
+ Children.Add (page3);
+ Children.Add (page4);
+ Children.Add (page5);
+ Children.Add (page6);
+ Children.Add (page7);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs
new file mode 100644
index 0000000..3f14a07
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Resources;
+using System.Text;
+using System.Threading.Tasks;
+#if HAVE_OPENTK
+using OpenTK.Graphics;
+using OpenTK.Graphics.ES20;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ public class RootTabbedNavigationContentPage : TabbedPage
+ {
+ public RootTabbedNavigationContentPage (string hierarchy)
+ {
+ AutomationId = hierarchy + "PageId";
+
+ var tabOne = new NavigationPage (new ContentPage {
+ Title = "Nav title",
+ Content = new SwapHierachyStackLayout (hierarchy)
+ }) { Title = "Tab 123", };
+
+ var tabTwo = new ContentPage {
+ Title = "Testing 345",
+ Content = new StackLayout {
+ Children = {
+ new Label { Text = "Hello" },
+ new AbsoluteLayout {
+ BackgroundColor = Color.Red,
+ VerticalOptions = LayoutOptions.FillAndExpand,
+ HorizontalOptions = LayoutOptions.FillAndExpand
+ },
+ new Button { Text = "Button" },
+ }
+ }
+ };
+
+ Children.Add (tabOne);
+ Children.Add (tabTwo);
+ }
+ }
+}
+
diff --git a/Xamarin.Forms.Controls/RootPages/SwapHierachyStackLayout.cs b/Xamarin.Forms.Controls/RootPages/SwapHierachyStackLayout.cs
new file mode 100644
index 0000000..de36357
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/SwapHierachyStackLayout.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ internal sealed class SwapRootButton : Button
+ {
+
+ public string PageStyleId { get; private set; }
+
+ public SwapRootButton (string hierarchyDescription, Command command)
+ {
+ AutomationId = hierarchyDescription + "ButtonId";
+ Text = hierarchyDescription;
+
+ Command = command;
+ }
+ }
+
+ internal class SwapHierachyStackLayout : ScrollView
+ {
+ public SwapHierachyStackLayout (string heirarchy)
+ {
+ AutomationId = "ChoosePageScrollView";
+
+ BackgroundColor = Color.Blue;
+
+ var buttons = new [] {
+ new SwapRootButton ("Content", new Command (() => Application.Current.MainPage = new RootContentPage ("Content"))),
+ new SwapRootButton ("Nav->Content", new Command (() => Application.Current.MainPage = new RootNavigationContentPage ("Nav->Content"))),
+ new SwapRootButton ("MDP->Nav->Content", new Command (() => Application.Current.MainPage = new RootMDPNavigationContentPage ("MDP->Nav->Content"))),
+ new SwapRootButton ("Tab->Content", new Command (() => Application.Current.MainPage = new RootTabbedContentPage ("Tab->Content"))),
+ new SwapRootButton ("Tab->MDP->Nav->Content", new Command (() => Application.Current.MainPage = new RootTabbedMDPNavigationContentPage ("Tab->MDP->Nav->Content"))),
+ new SwapRootButton ("Tab->Nav->Content", new Command (() => Application.Current.MainPage = new RootTabbedNavigationContentPage ("Tab->Nav->Content"))),
+ new SwapRootButton ("Tab(Many)->Nav->Content", new Command (() => Application.Current.MainPage = new RootTabbedManyNavigationContentPage ("Tab(Many)->Nav->Content"))),
+ // tsk tsk
+ new SwapRootButton ("Nav->Tab->Content(BAD IDEA)", new Command (() => Application.Current.MainPage = new RootNavigationTabbedContentPage ("Nav->Tab->Content(BAD IDEA)"))),
+ new SwapRootButton ("Nav->Tab(Many)->Content(BAD IDEA)", new Command (() => Application.Current.MainPage = new RootNavigationManyTabbedPage ("Nav->Tab(Many)->Content(BAD IDEA)"))),
+ new SwapRootButton ("MDP->Nav->Tab->Content(BAD IDEA)", new Command (() => Application.Current.MainPage = new RootMDPNavigationTabbedContentPage ("MDP->Nav->Tab->Content(BAD IDEA)"))),
+ // modals
+ new SwapRootButton ("(Modal)Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootContentPage ("(Modal)Content")))),
+ new SwapRootButton ("(Modal)Nav->Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootNavigationContentPage ("(Modal)Nav->Content")))),
+ new SwapRootButton ("(Modal)MDP->Nav->Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootMDPNavigationContentPage ("(Modal)MDP->Nav->Content")))),
+ new SwapRootButton ("(Modal)Tab->Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedContentPage ("(Modal)Tab->Content")))),
+ new SwapRootButton ("(Modal)Tab->MDP->Nav->Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedMDPNavigationContentPage ("(Modal)Tab->MDP->Nav->Content")))),
+ new SwapRootButton ("(Modal)Tab->Nav->Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedNavigationContentPage ("(Modal)Tab->Nav->Content")))),
+ new SwapRootButton ("(Modal)Tab(Many)->Nav->Content", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedManyNavigationContentPage ("(Modal)Tab(Many)->Nav->Content")))),
+ // tsk tsk
+ new SwapRootButton ("(Modal)Nav->Tab->Content(BAD IDEA)", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootNavigationTabbedContentPage ("(Modal)Nav->Tab->Content(BAD IDEA)")))),
+ new SwapRootButton ("(Modal)Nav->Tab(Many)->Content(BAD IDEA)", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootNavigationManyTabbedPage ("(Modal)Nav->Tab(Many)->Content(BAD IDEA)")))),
+ new SwapRootButton ("(Modal)MDP->Nav->Tab->Content(BAD IDEA)", new Command (async () => await Application.Current.MainPage.Navigation.PushModalAsync(new RootMDPNavigationTabbedContentPage ("(Modal)MDP->Nav->Tab->Content(BAD IDEA)")))),
+ new SwapRootButton ("(Modal)CoreGallery", new Command (() => Application.Current.MainPage = CoreGallery.GetMainPage ()))
+ };
+
+ var layout = new StackLayout ();
+
+ layout.Children.Add (new Label { Text = heirarchy });
+
+ foreach (var button in buttons) {
+ layout.Children.Add (button);
+ }
+
+ Content = layout;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls/RootPages/TabbedNavPage.cs b/Xamarin.Forms.Controls/RootPages/TabbedNavPage.cs
new file mode 100644
index 0000000..e33d5ae
--- /dev/null
+++ b/Xamarin.Forms.Controls/RootPages/TabbedNavPage.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ // TabbedPage -> NavigationPage
+ public class TabbedNavPage : MasterDetailPage
+ {
+ public TabbedNavPage ()
+ {
+ NavigationPage navpage = null;
+ navpage = new NavigationPage (new ContentPage {
+ Title = "Content0",
+ Content = new Button {
+ Text = "Button",
+ Command = new Command (() => {
+ Debug.WriteLine ("k");
+ navpage.PushAsync (new ContentPage () {Title = "Content1"});
+ })
+ }
+ }) {
+ Title = "Page0",
+ };
+
+ Children.add(navpage);
+ Children.add(new HomeButton ());
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/TestCases.cs b/Xamarin.Forms.Controls/TestCases.cs
new file mode 100644
index 0000000..fc60102
--- /dev/null
+++ b/Xamarin.Forms.Controls/TestCases.cs
@@ -0,0 +1,213 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using Xamarin.Forms.Controls.TestCasesPages;
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ public static class TestCases
+ {
+ public class TestCaseScreen : TableView
+ {
+ public static Dictionary<string, Action> PageToAction = new Dictionary<string, Action> ();
+
+ static TextCell MakeIssueCell (string text, string detail, Action tapped)
+ {
+ PageToAction[text] = tapped;
+ if (detail != null)
+ PageToAction[detail] = tapped;
+
+ var cell = new TextCell { Text = text, Detail = detail };
+ cell.Tapped += (s, e) => tapped();
+ return cell;
+ }
+
+ Action ActivatePageAndNavigate (IssueAttribute issueAttribute, Type type)
+ {
+ Action navigationAction = null;
+
+ if (issueAttribute.NavigationBehavior == NavigationBehavior.PushAsync) {
+ return async () => {
+ var page = ActivatePage (type);
+ TrackOnInsights (page);
+ await Navigation.PushAsync (page);
+ };
+ }
+
+ if (issueAttribute.NavigationBehavior == NavigationBehavior.PushModalAsync) {
+ return async () => {
+ var page = ActivatePage (type);
+ TrackOnInsights (page);
+ await Navigation.PushModalAsync (page);
+ };
+ }
+
+ if (issueAttribute.NavigationBehavior == NavigationBehavior.Default) {
+ return async () => {
+ var page = ActivatePage (type);
+ TrackOnInsights (page);
+ if (page is ContentPage || page is CarouselPage) {
+
+ await Navigation.PushAsync (page);
+
+ } else {
+ await Navigation.PushModalAsync (page);
+ }
+ };
+ }
+
+ if (issueAttribute.NavigationBehavior == NavigationBehavior.SetApplicationRoot) {
+ return () => {
+ var page = ActivatePage (type);
+ TrackOnInsights (page);
+ Application.Current.MainPage = page;
+ };
+ }
+
+ return navigationAction;
+ }
+
+ static void TrackOnInsights (Page page)
+ {
+ if (Insights.IsInitialized) {
+ Insights.Track ("Navigation", new Dictionary<string, string> {
+ {
+ "Pushing",
+ page.GetType ().Name
+ }
+ });
+ }
+ }
+
+ Page ActivatePage (Type type)
+ {
+ var page = Activator.CreateInstance (type) as Page;
+ if (page == null) {
+ throw new InvalidCastException ("Issue must be of type Page");
+ }
+ return page;
+ }
+
+ public TestCaseScreen ()
+ {
+ AutomationId = "TestCasesIssueList";
+
+ Intent = TableIntent.Settings;
+
+ var assembly = typeof (TestCases).GetTypeInfo ().Assembly;
+
+ var issueModels =
+ from typeInfo in assembly.DefinedTypes.Select (o => o.AsType ().GetTypeInfo ())
+ where typeInfo.GetCustomAttribute<IssueAttribute> () != null
+ let attribute = (IssueAttribute)typeInfo.GetCustomAttribute<IssueAttribute> ()
+ select new {
+ IssueTracker = attribute.IssueTracker,
+ IssueNumber = attribute.IssueNumber,
+ Name = attribute.IssueTracker.ToString ().Substring(0, 1) + attribute.IssueNumber.ToString (),
+ Description = attribute.Description,
+ Action = ActivatePageAndNavigate (attribute, typeInfo.AsType ())
+ };
+
+ var root = new TableRoot ();
+ var section = new TableSection ("Bug Repro");
+ root.Add (section);
+
+ var duplicates = new HashSet<string> ();
+ issueModels.ForEach (im => {
+ if (duplicates.Contains (im.Name) && !IsExempt (im.Name)) {
+ throw new NotSupportedException ("Please provide unique tracker + issue number combo: " + im.IssueTracker.ToString () + im.IssueNumber.ToString ());
+ } else {
+ duplicates.Add (im.Name);
+ }
+ });
+
+ var githubIssueCells =
+ from issueModel in issueModels
+ where issueModel.IssueTracker == IssueTracker.Github
+ orderby issueModel.IssueNumber descending
+ select MakeIssueCell (issueModel.Name, issueModel.Description, issueModel.Action);
+
+ var bugzillaIssueCells =
+ from issueModel in issueModels
+ where issueModel.IssueTracker == IssueTracker.Bugzilla
+ orderby issueModel.IssueNumber descending
+ select MakeIssueCell (issueModel.Name, issueModel.Description, issueModel.Action);
+
+ var untrackedIssueCells =
+ from issueModel in issueModels
+ where issueModel.IssueTracker == IssueTracker.None
+ orderby issueModel.Description
+ select MakeIssueCell (issueModel.Name, issueModel.Description, issueModel.Action);
+
+ var issueCells = bugzillaIssueCells.Concat (githubIssueCells).Concat (untrackedIssueCells);
+
+ foreach (var issueCell in issueCells) {
+ section.Add (issueCell);
+ }
+
+ Root = root;
+ }
+
+ // Legacy reasons, do not add to this list
+ // Going forward, make sure only one Issue attribute exist for a Tracker + Issue number pair
+ bool IsExempt (string name)
+ {
+ if (name == "G1461" ||
+ name == "G342" ||
+ name == "G1305" ||
+ name == "G1653" ||
+ name == "N0")
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public static NavigationPage GetTestCases ()
+ {
+ var rootLayout = new StackLayout ();
+
+ var testCasesRoot = new ContentPage {
+ Title = "Bug Repro's",
+ Content = rootLayout
+ };
+
+ var searchBar = new SearchBar() {
+ AutomationId = "SearchBarGo"
+ };
+
+ var searchButton = new Button () {
+ Text = "Search And Go To Issue",
+ AutomationId = "SearchButton",
+ Command = new Command (() => {
+ try {
+ TestCaseScreen.PageToAction[searchBar.Text] ();
+ } catch (Exception e) {
+ System.Diagnostics.Debug.WriteLine (e.Message);
+ }
+
+ })
+ };
+
+ var leaveTestCasesButton = new Button {
+ AutomationId = "GoBackToGalleriesButton",
+ Text = "Go Back to Galleries",
+ Command = new Command (() => testCasesRoot.Navigation.PopModalAsync ())
+ };
+
+ rootLayout.Children.Add (leaveTestCasesButton);
+ rootLayout.Children.Add (searchBar);
+ rootLayout.Children.Add (searchButton);
+ rootLayout.Children.Add (new TestCaseScreen ());
+
+ return new NavigationPage (testCasesRoot) {
+ Title = Device.OnPlatform ("Test Cases", "Test Cases", "Tests")
+ };
+ }
+ }
+
+}
diff --git a/Xamarin.Forms.Controls/ViewContainers/EventViewContainer.cs b/Xamarin.Forms.Controls/ViewContainers/EventViewContainer.cs
new file mode 100644
index 0000000..2095c03
--- /dev/null
+++ b/Xamarin.Forms.Controls/ViewContainers/EventViewContainer.cs
@@ -0,0 +1,32 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class EventViewContainer<T> : ViewContainer<T>
+ where T : View
+ {
+ string _formsMember;
+ Label _eventLabel;
+ int _numberOfTimesFired;
+
+ public EventViewContainer (Enum formsMember, T view) : base (formsMember, view)
+ {
+ _numberOfTimesFired = 0;
+
+ _formsMember = formsMember.ToString ();
+
+ _eventLabel = new Label {
+ AutomationId = formsMember + "EventLabel",
+ Text = "Event: " + _formsMember + " (none)"
+ };
+
+ ContainerLayout.Children.Add (_eventLabel);
+ }
+
+ public void EventFired ()
+ {
+ _numberOfTimesFired++;
+ _eventLabel.Text = "Event: " + _formsMember + " (fired " + _numberOfTimesFired + ")";
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ViewContainers/LayeredViewContainer.cs b/Xamarin.Forms.Controls/ViewContainers/LayeredViewContainer.cs
new file mode 100644
index 0000000..e22ecfb
--- /dev/null
+++ b/Xamarin.Forms.Controls/ViewContainers/LayeredViewContainer.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class LayeredViewContainer<T> : ViewContainer<T>
+ where T : View
+ {
+ public LayeredViewContainer (Enum formsMember, T view) : base (formsMember, view)
+ {
+ var layout = new AbsoluteLayout ();
+
+ var hiddenButton = new Button {
+ AutomationId = formsMember + "LayeredHiddenButton",
+ Text = "Covered Up"
+ };
+
+ layout.Children.Add (hiddenButton);
+ AbsoluteLayout.SetLayoutFlags (hiddenButton, AbsoluteLayoutFlags.All);
+ AbsoluteLayout.SetLayoutBounds (hiddenButton, new Rectangle (0, 0, 1, 1));
+ layout.Children.Add (view);
+ AbsoluteLayout.SetLayoutBounds (view, new Rectangle (0, 0, 1, 1));
+ AbsoluteLayout.SetLayoutFlags (view, AbsoluteLayoutFlags.All);
+
+ var hiddenLabel = new Label {
+ AutomationId = formsMember + "LayeredLabel",
+ Text = "Hidden Button (Not Clicked)"
+ };
+
+ hiddenButton.Clicked += (sender, args) => { hiddenLabel.Text = "Hidden Button (Clicked)"; };
+
+ ContainerLayout = new StackLayout {
+ AutomationId = formsMember + "Container",
+ Padding = 10,
+ Children = { TitleLabel, BoundsLabel, layout, hiddenLabel }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ViewContainers/MultiBindingHack.cs b/Xamarin.Forms.Controls/ViewContainers/MultiBindingHack.cs
new file mode 100644
index 0000000..4853fd1
--- /dev/null
+++ b/Xamarin.Forms.Controls/ViewContainers/MultiBindingHack.cs
@@ -0,0 +1,47 @@
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ internal class MultiBindingHack : INotifyPropertyChanged
+ {
+ string _labelWithBounds;
+
+ public MultiBindingHack (VisualElement element)
+ {
+ LabelWithBounds = string.Format("{{X={0:0.00} Y={1:0.00} Width={2:0.00} Height={3:0.00}}}", element.X, element.Y, element.Width, element.Height);
+
+ element.PropertyChanged += (sender, args) => {
+ if (args.PropertyName == "X" ||
+ args.PropertyName == "Y" ||
+ args.PropertyName == "Width" ||
+ args.PropertyName == "Height" ||
+ args.PropertyName == "Rotation") {
+ LabelWithBounds = string.Format("{{X={0:0.00} Y={1:0.00} Width={2:0.00} Height={3:0.00}}}", element.X, element.Y, element.Width, element.Height); // super hack
+ }
+ };
+ }
+
+ public string LabelWithBounds
+ {
+ get { return _labelWithBounds; }
+ set
+ {
+ if (_labelWithBounds == value)
+ return;
+ _labelWithBounds = value;
+ OnPropertyChanged ();
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ void OnPropertyChanged ([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null)
+ handler (this, new PropertyChangedEventArgs (propertyName));
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ViewContainers/StateViewContainer.cs b/Xamarin.Forms.Controls/ViewContainers/StateViewContainer.cs
new file mode 100644
index 0000000..b08cc30
--- /dev/null
+++ b/Xamarin.Forms.Controls/ViewContainers/StateViewContainer.cs
@@ -0,0 +1,48 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class StateViewContainer<T> : ViewContainer<T>
+ where T : View
+ {
+ public Button StateChangeButton { get; private set; }
+ public Label ViewInteractionLabel { get; private set; }
+
+ public StateViewContainer (Enum formsMember, T view) : base (formsMember, view)
+ {
+ var name = formsMember.ToString ();
+
+ var stateTitleLabel = new Label {
+ Text = name + "?"
+ };
+
+ ViewInteractionLabel = new Label {
+ Text = "Interacted? : False"
+ };
+
+ var stateValueLabel = new Label {
+ BindingContext = view,
+ AutomationId = name + "StateLabel"
+ };
+ if (name != "Focus")
+ stateValueLabel.SetBinding (Label.TextProperty, name, converter: new GenericValueConverter (o => o.ToString()));
+
+ StateChangeButton = new Button {
+ Text = "Change State: " + name,
+ AutomationId = name + "StateButton"
+ };
+
+ var labelLayout = new StackLayout {
+ Orientation = StackOrientation.Horizontal,
+ Children = {
+ stateTitleLabel,
+ stateValueLabel
+ }
+ };
+
+ ContainerLayout.Children.Add (ViewInteractionLabel);
+ ContainerLayout.Children.Add (labelLayout);
+ ContainerLayout.Children.Add (StateChangeButton);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ViewContainers/ValueViewContainer.cs b/Xamarin.Forms.Controls/ViewContainers/ValueViewContainer.cs
new file mode 100644
index 0000000..08dcc16
--- /dev/null
+++ b/Xamarin.Forms.Controls/ViewContainers/ValueViewContainer.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class ValueViewContainer<T> : ViewContainer<T> where T : View
+ {
+ public ValueViewContainer (Enum formsMember, T view, string bindingPath, Func<object, object> converterAction) : base (formsMember, view)
+ {
+
+ var valueLabel = new Label { BindingContext = View };
+ valueLabel.SetBinding (Label.TextProperty, bindingPath, converter: new GenericValueConverter (converterAction));
+
+ ContainerLayout.Children.Add (valueLabel);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/ViewContainers/ViewContainer.cs b/Xamarin.Forms.Controls/ViewContainers/ViewContainer.cs
new file mode 100644
index 0000000..f12a003
--- /dev/null
+++ b/Xamarin.Forms.Controls/ViewContainers/ViewContainer.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Linq.Expressions;
+
+namespace Xamarin.Forms.Controls
+{
+ internal enum ViewLayoutType
+ {
+ Normal,
+ Layered
+ }
+
+ internal class ViewContainer<T>
+ where T : View
+ {
+
+ public Label TitleLabel { get; private set; }
+ public Label BoundsLabel { get; private set; }
+ public T View { get; private set; }
+
+ // May want to override the container layout in subclasses
+ public StackLayout ContainerLayout { get; protected set; }
+
+ public ViewContainer (Enum formsMember, T view)
+ {
+ view.AutomationId = formsMember + "VisualElement";
+ View = view;
+
+ TitleLabel = new Label {
+ Text = formsMember + " View"
+ };
+
+ BoundsLabel = new Label {
+ BindingContext = new MultiBindingHack (view)
+ };
+ BoundsLabel.SetBinding (Label.TextProperty, "LabelWithBounds");
+
+ ContainerLayout = new StackLayout {
+ AutomationId = formsMember + "Container",
+ Padding = 10,
+ Children = { TitleLabel, BoundsLabel, view }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
new file mode 100644
index 0000000..c56b143
--- /dev/null
+++ b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{CB9C96CE-125C-4A68-B6A1-C3FF1FBF93E1}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Xamarin.Forms.Controls</RootNamespace>
+ <AssemblyName>Xamarin.Forms.Controls</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;PERF;APP</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE;APP</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Turkey\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;PERF;APP</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <!-- A reference to the entire .NET Framework is automatically included -->
+ <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
+ <Project>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</Project>
+ <Name>Xamarin.Forms.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Xamarin.Forms.Build.Tasks\Xamarin.Forms.Build.Tasks.csproj">
+ <Project>{96D89208-4EB9-4451-BE73-8A9DF3D9D7B7}</Project>
+ <Name>Xamarin.Forms.Build.Tasks</Name>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj">
+ <Project>{4dcd0420-1168-4b77-86db-6196ee4bd491}</Project>
+ <Name>Xamarin.Forms.CustomAttributes</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj">
+ <Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project>
+ <Name>Xamarin.Forms.Maps</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj">
+ <Project>{9db2f292-8034-4e06-89ad-98bbda4306b9}</Project>
+ <Name>Xamarin.Forms.Xaml</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="App.cs" />
+ <Compile Include="ControlGalleryPages\CellForceUpdateSizeGalleryPage.cs" />
+ <Compile Include="ControlGalleryPages\LayoutAddPerformance.xaml.cs">
+ <DependentUpon>LayoutAddPerformance.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="ControlGalleryPages\ListScrollTo.cs" />
+ <Compile Include="ControlGalleryPages\NavBarTitleTestPage.cs" />
+ <Compile Include="ControlGalleryPages\NestedNativeControlGalleryPage.cs" />
+ <Compile Include="ControlGalleryPages\PanGestureGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\KeyboardCoreGalleryPage.cs" />
+ <Compile Include="GalleryPages\BackgroundImageGallery.cs" />
+ <Compile Include="GalleryPages\CarouselViewGallery.cs" />
+ <Compile Include="GalleryPages\ControlTemplatePage.cs" />
+ <Compile Include="GalleryPages\ControlTemplateXamlPage.xaml.cs">
+ <DependentUpon>ControlTemplateXamlPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="GalleryPages\LayoutPerformanceGallery.cs" />
+ <Compile Include="GalleryPages\NavigationPropertiesGallery.cs" />
+ <Compile Include="ControlGalleryPages\ListViewSelectionColor.cs" />
+ <Compile Include="LegacyRepro\Page1.xaml.cs">
+ <DependentUpon>Page1.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="RootPages\RootContentPage.cs" />
+ <Compile Include="RootPages\SwapHierachyStackLayout.cs" />
+ <Compile Include="GalleryPages\EditableList.cs" />
+ <Compile Include="CoreGalleryPages\EditorCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\EntryCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\FrameCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\ImageCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\LabelCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\ListViewCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\OpenGLViewCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\PickerCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\ProgressBarCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\SearchBarCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\SliderCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\StepperCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\SwitchCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\TableViewCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\TimePickerCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\WebViewCoreGalleryPage.cs" />
+ <Compile Include="LegacyRepro\SampleViewCell.xaml.cs">
+ <DependentUpon>SampleViewCell.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="ViewContainers\EventViewContainer.cs" />
+ <Compile Include="ViewContainers\LayeredViewContainer.cs" />
+ <Compile Include="ViewContainers\MultiBindingHack.cs" />
+ <Compile Include="ViewContainers\StateViewContainer.cs" />
+ <Compile Include="ViewContainers\ValueViewContainer.cs" />
+ <Compile Include="ViewContainers\ViewContainer.cs" />
+ <Compile Include="CoreGalleryPages\ActivityIndicatorCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\CoreBoxViewGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\ButtonCoreGalleryPage.cs" />
+ <Compile Include="CoreGallery.cs" />
+ <Compile Include="CoreGalleryPages\DatePickerCoreGalleryPage.cs" />
+ <Compile Include="CoreGalleryPages\CoreGalleryPage.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TestCases.cs" />
+ <Compile Include="GalleryPages\GridGallery.cs" />
+ <Compile Include="GalleryPages\PickerGallery.cs" />
+ <Compile Include="GalleryPages\ImageLoadingGallery.cs" />
+ <Compile Include="GalleryPages\CarouselPageGallery.cs" />
+ <Compile Include="GalleryPages\StepperGallery.cs" />
+ <Compile Include="GalleryPages\ScaleRotate.cs" />
+ <Compile Include="GalleryPages\LineBreakModeGallery.cs" />
+ <Compile Include="GalleryPages\ActionSheetGallery.cs" />
+ <Compile Include="GalleryPages\XamlPage.xaml.cs">
+ <DependentUpon>XamlPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="RootPages\RootTabbedContentPage.cs" />
+ <Compile Include="RootPages\RootTabbedNavigationContentPage.cs" />
+ <Compile Include="RootPages\RootNavigationContentPage.cs" />
+ <Compile Include="RootPages\RootNavigationTabbedContentPage.cs" />
+ <Compile Include="RootPages\RootMDPNavigationContentPage.cs" />
+ <Compile Include="RootPages\RootTabbedMDPNavigationContentPage.cs" />
+ <Compile Include="RootPages\RootTabbedManyNavigationContentPage.cs" />
+ <Compile Include="RootPages\RootNavigationManyTabbedPage.cs" />
+ <Compile Include="ControlGalleryPages\BehaviorsAndTriggers.xaml.cs">
+ <DependentUpon>BehaviorsAndTriggers.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="GalleryPages\CellsGalleries\EntryCellListPage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\EntryCellTablePage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\ImageCellListPage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\ImageCellTablePage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\ProductViewCell.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\SwitchCellListPage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\SwitchCellTablePage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\TextCellListPage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\TextCellTablePage.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\UnEvenViewCellGallery.cs" />
+ <Compile Include="GalleryPages\CellsGalleries\ViewCellGallery.cs" />
+ <Compile Include="GalleryPages\AbsoluteLayoutGallery.cs" />
+ <Compile Include="GalleryPages\BoundContentPage.cs" />
+ <Compile Include="GalleryPages\ButtonGallery.cs" />
+ <Compile Include="GalleryPages\CellTypeList.cs" />
+ <Compile Include="GalleryPages\ClipToBoundsGallery.cs" />
+ <Compile Include="GalleryPages\DisposeGallery.cs" />
+ <Compile Include="GalleryPages\EditorGallery.cs" />
+ <Compile Include="GalleryPages\EntryGallery.cs" />
+ <Compile Include="GalleryPages\FrameGallery.cs" />
+ <Compile Include="GalleryPages\GroupedListActionsGallery.cs" />
+ <Compile Include="GalleryPages\GroupedListContactsGallery.cs" />
+ <Compile Include="GalleryPages\ImageGallery.cs" />
+ <Compile Include="GalleryPages\InputIntentGallery.cs" />
+ <Compile Include="GalleryPages\LabelGallery.cs" />
+ <Compile Include="GalleryPages\LayoutOptionsGallery.cs" />
+ <Compile Include="GalleryPages\ListPage.cs" />
+ <Compile Include="GalleryPages\ListViewDemoPage.cs" />
+ <Compile Include="GalleryPages\MapGallery.cs" />
+ <Compile Include="GalleryPages\MinimumSizeGallery.cs" />
+ <Compile Include="GalleryPages\MultiGallery.cs" />
+ <Compile Include="GalleryPages\NavigationBarGallery.cs" />
+ <Compile Include="GalleryPages\NavigationMenuGallery.cs" />
+ <Compile Include="GalleryPages\OpenGLGallery.cs" />
+ <Compile Include="GalleryPages\ProgressBarGallery.cs" />
+ <Compile Include="GalleryPages\RelativeLayoutGallery.cs" />
+ <Compile Include="GalleryPages\ScrollGallery.cs" />
+ <Compile Include="GalleryPages\SearchBarGallery.cs" />
+ <Compile Include="GalleryPages\SettingsPage.cs" />
+ <Compile Include="GalleryPages\SliderGallery.cs" />
+ <Compile Include="GalleryPages\StackLayoutGallery.cs" />
+ <Compile Include="GalleryPages\SwitchGallery.cs" />
+ <Compile Include="GalleryPages\TableViewGallery.cs" />
+ <Compile Include="GalleryPages\TemplatedCarouselGallery.cs" />
+ <Compile Include="GalleryPages\TemplatedTabbedGallery.cs" />
+ <Compile Include="GalleryPages\ToolbarGallery.cs" />
+ <Compile Include="GalleryPages\UnevenListGallery.cs" />
+ <Compile Include="GalleryPages\WebViewGallery.cs" />
+ <Compile Include="GalleryPages\StyleGallery.cs" />
+ <Compile Include="GalleryPages\StyleXamlGallery.xaml.cs">
+ <DependentUpon>StyleXamlGallery.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="GalleryPages\MasterDetailPageTabletPage.cs" />
+ <Compile Include="Helpers\ITestCloudService.cs" />
+ <Compile Include="ControlGalleryPages\ToolbarItems.cs" />
+ <Compile Include="GalleryPages\AlertGallery.cs" />
+ <Compile Include="RootPages\RootMDPNavigationTabbedContentPage.cs" />
+ <Compile Include="Controls\Issue3076Button.cs" />
+ <Compile Include="ControlGalleryPages\ListRefresh.cs" />
+ <Compile Include="ControlGalleryPages\PinchGestureTestPage.cs" />
+ <Compile Include="ControlGalleryPages\AppearingGalleryPage.cs" />
+ <Compile Include="ControlGalleryPages\AutomationIDGallery.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+ <Import Project="..\.nuspec\Xamarin.Forms.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ItemGroup>
+ <EmbeddedResource Include="GalleryPages\crimson.jpg" />
+ <EmbeddedResource Include="GalleryPages\XamlPage.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="ControlGalleryPages\BehaviorsAndTriggers.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="GalleryPages\StyleXamlGallery.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+ <Import Project="..\Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems" Label="Shared" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <Import Project="..\packages\Xamarin.Insights.1.11.1\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.1\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" />
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+ <Error Condition="!Exists('..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets'))" />
+ </Target>
+ <ItemGroup>
+ <EmbeddedResource Include="ControlGalleryPages\LayoutAddPerformance.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="GalleryPages\ControlTemplateXamlPage.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="Xamarin.Insights, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="LegacyRepro\Page1.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="LegacyRepro\SampleViewCell.xaml">
+ <Generator>MSBuild:UpdateDeisgnTimeXaml</Generator>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="secrets.txt" />
+ </ItemGroup>
+ <Import Project="..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\portable-win+net45+wp80+windows8+wpa+MonoAndroid10+MonoTouch10\Xamarin.Insights.targets')" />
+</Project> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/app.config b/Xamarin.Forms.Controls/app.config
new file mode 100644
index 0000000..b1d2a5a
--- /dev/null
+++ b/Xamarin.Forms.Controls/app.config
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-0.9.6.0" newVersion="0.9.6.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/packages.config b/Xamarin.Forms.Controls/packages.config
new file mode 100644
index 0000000..7692cf9
--- /dev/null
+++ b/Xamarin.Forms.Controls/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Xamarin.Insights" version="1.11.4" targetFramework="portable45-net45+win8+wp8+wpa81" />
+</packages> \ No newline at end of file