From 65d848051912e1522d692ba647945625f271b23c Mon Sep 17 00:00:00 2001 From: Jimmy Garrido Date: Mon, 6 Mar 2017 14:19:36 -0800 Subject: [PATCH] [UWP] Improve toolbar consistency on MasterDetailPage (#744) * Improve toolbar consistency on MasterDetailPage * Properly indent xaml page --- .../Bugzilla51553.cs | 44 ++++++++++++++++++++++ .../Bugzilla51802.cs | 36 ++++++++++++++++++ .../Xamarin.Forms.Controls.Issues.Shared.projitems | 2 + Xamarin.Forms.Platform.UAP/MasterDetailControl.cs | 3 ++ .../MasterDetailControlStyle.xaml | 34 ++++++++--------- .../MasterDetailPageRenderer.cs | 28 +++++++------- .../NavigationPageRenderer.cs | 10 ++--- 7 files changed, 121 insertions(+), 36 deletions(-) create mode 100644 Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51553.cs create mode 100644 Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51802.cs diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51553.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51553.cs new file mode 100644 index 0000000..1362ac0 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51553.cs @@ -0,0 +1,44 @@ +using System; +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 51553, "[UWP] Toolbar not shown on first Detail page", PlatformAffected.WinRT)] + public class Bugzilla51553 : TestMasterDetailPage + { + protected override void Init() + { + Master = new ContentPage + { + Title = "Master", + BackgroundColor = Color.Red + }; + + Detail = new NavigationPage(new TestPage()); + } + + class TestPage : ContentPage + { + public TestPage() + { + Title = "Test Page"; + + ToolbarItems.Add(new ToolbarItem("Test", "coffee.png", () => System.Diagnostics.Debug.WriteLine("ToolbarItem pressed"))); + + Content = new StackLayout + { + Children = { + new Label { Text = "If the ToolbarItem is not visible then this test has failed." } + } + }; + } + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51802.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51802.cs new file mode 100644 index 0000000..f73653e --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51802.cs @@ -0,0 +1,36 @@ +using System; +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 51802, "[UWP] Detail Page Has Navigation Bar Even When Not Inside a NavigationPage", PlatformAffected.WinRT)] + public class Bugzilla51802 : TestMasterDetailPage + { + protected override void Init() + { + Master = new ContentPage + { + Title = "Master", + BackgroundColor = Color.Red + }; + + Detail = new ContentPage + { + Content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label { Text = "If a navigation bar is present on this page then this test has failed." } + } + } + }; + } + } +} diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 4490cf0..2876319 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -172,6 +172,8 @@ + + diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs b/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs index 79da59c..56dd4d9 100644 --- a/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs +++ b/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs @@ -294,6 +294,9 @@ namespace Xamarin.Forms.Platform.UWP ContentTogglePaneButtonVisibility = _split.DisplayMode == SplitViewDisplayMode.Overlay ? Visibility.Visible : Visibility.Collapsed; + + if (ContentTogglePaneButtonVisibility == Visibility.Visible) + DetailTitleVisibility = Visibility.Visible; } } } \ No newline at end of file diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailControlStyle.xaml b/Xamarin.Forms.Platform.UAP/MasterDetailControlStyle.xaml index 3f13f76..ee51204 100644 --- a/Xamarin.Forms.Platform.UAP/MasterDetailControlStyle.xaml +++ b/Xamarin.Forms.Platform.UAP/MasterDetailControlStyle.xaml @@ -29,26 +29,26 @@ - - - - - + + + + + -