summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla37601.cs
blob: bc9e4ec31303707a01bda660b10fa08368888dbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls
{
    [Preserve (AllMembers = true)]
    [Issue (IssueTracker.Bugzilla, 37601, "ToolbarItem throws error when navigating to TabbedPage ",
        PlatformAffected.WinPhone)]
    public class Bugzilla37601 : TestNavigationPage
    {
        protected override void Init ()
        {
            Navigation.PushAsync (new SelectPage ());
        }
    }

    internal class SelectPage : ContentPage
    {
        public SelectPage ()
        {
            var button = new Button { Text = "Move" };

            var label = new Label {
                Text =
                    "Click the Move button. If the next page is displayed, the test has passed. If the app crashes, the test has failed."
            };

            Content = new StackLayout {
                Children = { label, button }
            };

            button.Clicked += (sender, args) => { Navigation.PushAsync (new TabbedMain (), true); };

            ToolbarItems.Add (new ToolbarItem { Text = "Log Out" });
        }
    }

    internal class TabbedMain : TabbedPage
    {
        public TabbedMain ()
        {
            var page1 = new ContentPage { Title = "Page1" };
            page1.Content = new StackLayout {
                Children = { new Label { Text = "If you can see this, we haven't crashed. Yay!" } }
            };

           Children.Add (page1);
           Children.Add (new ContentPage { Title = "Page2" });
        }
    }
}