Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

my gridview doesn't show any data in view

$
0
0

i used xlab gridview control and my gridview doesn't return any data it shows blank...
here is the code

public class GridPhotos : ContentPage
{
public GridPhotos ()
{
BackgroundColor = Color.Yellow;
Title = "Photo Gallery";
Icon = "Leads.png";

        Label header = new Label
        {   MinimumWidthRequest=910,
            WidthRequest=910,
            Text = "Photo Gallery",

            TextColor=Color.White,
            Font = Font.SystemFontOfSize(30, FontAttributes.Bold),
            BackgroundColor=Color.FromHex("68c769"),
            HorizontalOptions = LayoutOptions.Center
        };


        //Create GridView.
        GridView gridview = new GridView
        {   BackgroundColor=Color.White,

                RowSpacing=5,
                Padding=5,
                ColumnSpacing = 5,
                ItemWidth =152,
                ItemHeight = 200,

            ItemsSource = PhotoGalleryDatasource.GetList(),

            // Define template for displaying each item.
            // (Argument of DataTemplate constructor is called for 
            //      each item; it must return a Cell derivative.)
            ItemTemplate = new DataTemplate(() =>
                {
                    Label titleLabel = new Label(){
                        FontAttributes=FontAttributes.Bold,
                        FontSize=16,
                        TextColor=Color.Black
                    };
                    titleLabel.SetBinding(Label.TextProperty, "Title");

                    // Return an assembled ViewCell.
                    return new ViewCell
                    {

                        View = new StackLayout
                        {       Children = 
                                    {   //newsimage
                                        titleLabel

                            }
                            }
                    };
                })
        };

        this.Content = new StackLayout
        {
            HorizontalOptions = LayoutOptions.Start,
            VerticalOptions =  LayoutOptions.Start,

            Children = 
            {
                header,
                gridview
            }
            };
    }
}

}


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>