示例#1
0
        static Page CreatePage()
        {
            var page     = new WeakReferencedPage();
            var contents = new StackLayout();

            contents.Children.Add(new Button
            {
                Text    = "Next Page",
                Command = new Command(() => page.Navigation.PushAsync(CreateWeakReferencedPage()))
            });

            contents.Children.Add(new Label
            {
                Text = string.Format("References alive at time of creation: {0}", s_pageRefs.Count(p => p.IsAlive)),
                HorizontalOptions = LayoutOptions.CenterAndExpand
            });

            var listView = new ListView {
                BindingContext = s_fakeProvider
            };

            listView.SetBinding(ListView.ItemsSourceProperty, "Items");
            contents.Children.Add(listView);

            page.Content = contents;
            return(page);
        }
示例#2
0
		static Page CreatePage()
		{
			var page = new WeakReferencedPage();
			var contents = new StackLayout();

			contents.Children.Add (new Button {
				Text = "Next Page",
				Command = new Command(() => page.Navigation.PushAsync(CreateWeakReferencedPage()))
			});

			contents.Children.Add (new Label {
				Text = string.Format ("References alive at time of creation: {0}", s_pageRefs.Count(p => p.IsAlive)),
				HorizontalOptions = LayoutOptions.CenterAndExpand
			});

			var listView = new ListView { BindingContext = s_fakeProvider };
			listView.SetBinding (ListView.ItemsSourceProperty, "Items");
			contents.Children.Add (listView);

			page.Content = contents;
			return page;
		}