diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1648.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1648.cs new file mode 100644 index 000000000..4ed2cf28d --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1648.cs @@ -0,0 +1,63 @@ +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.Github, 1648, "MasterDetailPage throws ArgumentOutOfRangeException", PlatformAffected.UWP)] + public class GitHub1648 : TestNavigationPage + { + protected override void Init() + { + Navigation.PushAsync(new MasterDetailPage + { + Master = new NavigationPage(new ContentPage()) + { + Title = "Master" + }, + Detail = new ContentPage(), + }); + } + + protected override void OnAppearing() + { + base.OnAppearing(); + Navigation.PushModalAsync(new SimplePage()); + } + + class SimplePage : ContentPage + { + public SimplePage () + { + Content = new StackLayout() + { + Children = { + new Label { + Text = "Success" + }, + new Button + { + Text = "Reload", + Command = new Command(() => Navigation.PopModalAsync()) + } + } + }; + } + } + +#if UITEST + [Test] + public void GitHub1648Test() + { + RunningApp.WaitForElement("Reload"); + RunningApp.Tap("Reload"); + RunningApp.WaitForElement("Success"); + } +#endif + } +} \ No newline at end of file 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 34bfba21a..a23ffd1da 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 @@ -243,6 +243,7 @@ + diff --git a/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs b/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs index d0a39f0e0..7fda8093c 100644 --- a/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs +++ b/Xamarin.Forms.Platform.UAP/MasterDetailControl.cs @@ -109,7 +109,7 @@ namespace Xamarin.Forms.Platform.UWP width -= _masterPresenter.ActualWidth; } - return new Windows.Foundation.Size(width >= 0 ? width : 0, height); + return new Windows.Foundation.Size(Math.Max(width, 0), Math.Max(height, 0)); } } @@ -181,7 +181,7 @@ namespace Xamarin.Forms.Platform.UWP else if (_masterPresenter != null) width = _masterPresenter.ActualWidth; - return new Windows.Foundation.Size(width, height); + return new Windows.Foundation.Size(Math.Max(width, 0), Math.Max(height, 0)); } }