This repository has been archived by the owner on May 1, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WinRT/UWP] Do not allow IsPresented use in Split mode on desktop (#707)
- Loading branch information
1 parent
bc13d3c
commit b53ccf0
Showing
4 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51236.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
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, 51236, "[WinRT/UWP] Setting a MasterDetailPage's IsPresented to false should not be allowed in Split mode", PlatformAffected.WinRT)] | ||
public class Bugzilla51236 : TestMasterDetailPage | ||
{ | ||
protected override void Init() | ||
{ | ||
var listView = new ListView | ||
{ | ||
ItemsSource = new string[] { "A", "B", "C" }, | ||
ItemTemplate = new DataTemplate(() => | ||
{ | ||
var cell = new ViewCell(); | ||
cell.View = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
new Label { Text = "Click to set IsPresented to false" } | ||
} | ||
}; | ||
return cell; | ||
}), | ||
}; | ||
|
||
IsPresented = false; | ||
listView.ItemTapped += (s, e) => | ||
{ | ||
IsPresented = false; | ||
listView.SelectedItem = null; | ||
Detail = new ContentPage | ||
{ | ||
Title = "Detail", | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
new Button | ||
{ | ||
Text = "Set IsPresented to true", | ||
Command = new Command(() => IsPresented = true) | ||
} | ||
} | ||
} | ||
}; | ||
}; | ||
|
||
Master = new ContentPage | ||
{ | ||
Title = "Master", | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
listView, | ||
new Button | ||
{ | ||
Text = "Set MasterBehavior to Popover", | ||
Command = new Command(() => | ||
{ | ||
MasterBehavior = MasterBehavior.Popover; | ||
IsPresented = false; | ||
}) | ||
}, | ||
new Button | ||
{ | ||
Text = "Set MasterBehavior to Split", | ||
Command = new Command(() => MasterBehavior = MasterBehavior.Split) | ||
}, | ||
new Button | ||
{ | ||
Text = "Set MasterBehavior to SplitOnLandscape", | ||
Command = new Command(() => MasterBehavior = MasterBehavior.SplitOnLandscape) | ||
}, | ||
} | ||
} | ||
}; | ||
|
||
Detail = new ContentPage | ||
{ | ||
Title = "Detail", | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
new Button | ||
{ | ||
Text = "Set IsPresented to true", | ||
Command = new Command(() => IsPresented = true) | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters