Exemple #1
0
 void DrawScreen()
 {
     PageStack = new StackLayout
     {
         HorizontalOptions = LayoutOptions.FillAndExpand,
         VerticalOptions = LayoutOptions.FillAndExpand,
         Padding = 0,
         BackgroundColor = Color.White
     };
     for (var i = 0; i < 100; i++)
     {
         var cellStack = new StackLayout
         {
             HeightRequest = 20,
             BackgroundColor = Color.White,
             HorizontalOptions = LayoutOptions.FillAndExpand,
             VerticalOptions = LayoutOptions.FillAndExpand,
             Padding = 1,
             Spacing = 1
         };
         var cellText = new Label
         {
             Text = i + " - Now is the time for all good men to come to the aid of their country.",
             BackgroundColor = Color.White,
             VerticalOptions = LayoutOptions.FillAndExpand,
             HeightRequest = 20,
             LineBreakMode = LineBreakMode.TailTruncation
         };
         cellStack.Children.Add(cellText);
         PageStack.Children.Add(cellStack);
         PageStack.Children.Add(new BoxView
             {
                 HeightRequest = 1,
                 BackgroundColor = Color.Gray.WithLuminosity(.9)
             });
     }
     PageScroll = new ScrollView
     {
         Content = PageStack
     };
     if (PopupContent == null)
     {
         //first parameter will take any View 
         //second parameter a reference to the current content window
         PopupContent = new PopupDialog(PageScroll, this);
     }
     Content = PopupContent;
     PopupContent.Closed += ((bool changed) =>
     {
         if (!ToolbarItems.Contains(PopupButton))
         {
             //put the toolbaritem back in navigation bar
             ToolbarItems.Add(PopupButton);
         }
         if (changed)
         {
             //call code to respond to the controls changed within the popup view.
             DisplayAlert("Popup Status", "This popup has changed!", "OK");
         }
     });
 }