diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls/RootPages | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls/RootPages')
14 files changed, 622 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/RootPages/CaseTenPage.cs b/Xamarin.Forms.Controls/RootPages/CaseTenPage.cs new file mode 100644 index 00000000..98527c46 --- /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 00000000..84cfa956 --- /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 00000000..0e4e004a --- /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 00000000..2a7de4ba --- /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 00000000..096b776c --- /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 00000000..8a3d450f --- /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 00000000..fdce27d1 --- /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 00000000..25c2987e --- /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 00000000..fdcfb921 --- /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 00000000..14bf7cf1 --- /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 00000000..e0a565a1 --- /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 00000000..3f14a07f --- /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 00000000..de363575 --- /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 00000000..e33d5aec --- /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 |