How to avoid starting space of the given Grid( attached screen shot picture) in the Custom Listview

NelsonthomaSNelsonthomaS INMember
edited January 2017 in Xamarin.Forms


Hey Team,

I am creating Grid in the Listview with below Grid Definitions:

Grid grid = new Grid
{
// HorizontalOptions = LayoutOptions.StartAndExpand,
//VerticalOptions = LayoutOptions.FillAndExpand,
//HeightRequest = 100, //?????????
//BackgroundColor = Color.Red,
RowSpacing=0,
ColumnSpacing=0,
ColumnDefinitions =
{
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},

                }
        };

Label lblinspectiondate = new Label
{
Text = "Inspection:",

        };

        Label valinspectiondate = new Label();
        valinspectiondate.SetBinding(Label.TextProperty, "ReadingDate");

        var btnBack = new Button
        {
            Image = "remove_icon_png_26.png",
            BackgroundColor = Color.White,
            HorizontalOptions = LayoutOptions.End,
            VerticalOptions = LayoutOptions.Center
        };

and here I returns the View cell of the custom Listview(code):

View = new StackLayout
{
// Padding = new Thickness(20, 5),
Orientation = StackOrientation.Vertical,
Children =
{
new StackLayout {
Orientation = StackOrientation.Horizontal,
Children = { lblinspectiondate, valinspectiondate,btnBack
}
},

                                                                           grid


                            },
        };

Best Answer

Answers

Sign In or Register to comment.