Inheritance: INotifyPropertyChanged
        public ListViewPage(bool insideLayout)
        {
            Title = "ListView (Pull to Refresh)";

            BindingContext = new TestViewModel (this);

            var listView = new ListView ();
            //ListView now has a built in pull to refresh! 
            //You most likely could enable the listview pull to refresh and use it instead of the refresh view
            //listView.IsPullToRefreshEnabled = true;
            //
            //listView.SetBinding<TestViewModel>(ListView.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay);
            //listView.SetBinding<TestViewModel>(ListView.RefreshCommandProperty, vm => vm.RefreshCommand);

            listView.SetBinding<TestViewModel> (ItemsView<Cell>.ItemsSourceProperty, vm => vm.Items);

            //ListView now has a built in pull to refresh! 
            //You most likely could disable the listview pull to refresh and re-enable this
            //However, I wouldn't recommend that.
            var refreshView = new PullToRefreshLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Content = new StackLayout
                    {
                        Spacing = 0,
                        Children = 
                            {
                                new Label
                                {
                                    TextColor = Color.White,
                                    Text = "In a StackLayout",
                                    FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                                    BackgroundColor = Color.FromHex("#3498db"),
                                    XAlign = TextAlignment.Center,
                                    HorizontalOptions = LayoutOptions.FillAndExpand
                                },
                                listView
                            }
                        },
                RefreshColor = Color.FromHex("#3498db")
            };

            refreshView.SetBinding<TestViewModel> (PullToRefreshLayout.IsRefreshingProperty, vm => vm.IsBusy);
            refreshView.SetBinding<TestViewModel>(PullToRefreshLayout.RefreshCommandProperty, vm => vm.RefreshCommand);


            if (insideLayout)
            {
                Content = new StackLayout
                {
                        Spacing = 0,
                        Children = 
                            {
                                new Label
                                {
                                    TextColor = Color.White,
                                    Text = "In a StackLayout",
                                    FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                                    BackgroundColor = Color.FromHex("#3498db"),
                                    XAlign = TextAlignment.Center,
                                    HorizontalOptions = LayoutOptions.FillAndExpand
                                },
                                refreshView
                            }
                };
            }
            else
            {
                Content = refreshView;
            }
        }
        public ScrollViewPage(bool insideLayout)
        {
            var random = new Random();
            Title = "ScrollView (Pull to Refresh)";

            BindingContext = new TestViewModel (this);


            var grid = new Grid
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    RowSpacing = 0,
                    ColumnSpacing = 0
                };
            
            var scrollView = new ScrollView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                    Content = grid
            };


            for (int i = 0; i < 20; i++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition{ Width = GridLength.Auto });
                for (int j = 0; j < 20; j++)
                {

                    if (i == 0)
                    {
                        grid.RowDefinitions.Add(new RowDefinition{ Height = GridLength.Auto });

                    }

                    grid.Children.Add(new BoxView
                        {
                            HeightRequest = 50,
                            VerticalOptions = LayoutOptions.FillAndExpand,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            BackgroundColor = Color.FromRgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255))
                        }, i, j);
                }

            }


            var refreshView = new PullToRefreshLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Content = scrollView,
                RefreshColor = Color.FromHex("#3498db")
            };

            refreshView.SetBinding<TestViewModel> (PullToRefreshLayout.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay);
            refreshView.SetBinding<TestViewModel>(PullToRefreshLayout.RefreshCommandProperty, vm => vm.RefreshCommand);



            if (insideLayout)
            {
                Content = new StackLayout
                    {
                        Spacing = 0,
                        Children = 
                        {
                            new Label
                            {
                                TextColor = Color.White,
                                Text = "In a StackLayout",
                                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                                BackgroundColor = Color.FromHex("#3498db"),
                                XAlign = TextAlignment.Center,
                                HorizontalOptions = LayoutOptions.FillAndExpand
                            },
                            refreshView
                        }
                    };
            }
            else
            {
                Content = refreshView;
            }
        }
 public ScrollViewXamlPage()
 {
     InitializeComponent();
     BindingContext = new TestViewModel(this);
 }
        public StackLayoutPage(bool insideLayout)
        {
            var random = new Random();
            Title = "StackLayout (Pull to Refresh)";

            BindingContext = new TestViewModel (this);

            var stack = new StackLayout
                {
                    VerticalOptions = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Spacing = 0
                };
            
            for (int i = 0; i < 20; i++)
            {
                stack.Children.Add(new BoxView
                    {
                        HeightRequest = 150,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        BackgroundColor = Color.FromRgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255))
                    });
            }

            var refreshView = new PullToRefreshLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Content = stack,
                RefreshColor = Color.FromHex("#3498db")
            };

            refreshView.SetBinding<TestViewModel> (PullToRefreshLayout.IsRefreshingProperty, vm => vm.IsBusy, BindingMode.OneWay);
            refreshView.SetBinding<TestViewModel>(PullToRefreshLayout.RefreshCommandProperty, vm => vm.RefreshCommand);


            if (insideLayout)
            {
                var activity = new ActivityIndicator();
                activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
                Content = new StackLayout
                    {
                        Spacing = 0,
                        Children = 
                            {
                                activity,
                                new Label
                                {
                                    TextColor = Color.White,
                                    Text = "In a StackLayout",
                                    FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                                    BackgroundColor = Color.FromHex("#3498db"),
                                    XAlign = TextAlignment.Center,
                                    HorizontalOptions = LayoutOptions.FillAndExpand
                                },
                                refreshView
                            }
                        };
            }
            else
            {
                Content = refreshView;
            }
        }