I have a frustrating issue trying to eliminate one pixel of spacing that just won't go away. What I'm trying to do is put a semi-transparent layer over the bottom of an image so I can put a title at the bottom. My "ImageTile" is a Grid with two children - one is the image, the other is another grid (that has the shading and text). Everything works great except that while the Image properly fills the entire parent grid, the grid for the shading/title sits one pixel above the bottom.
Am I not setting a property correctly somewhere?
Thanks!
"this" is the Grid that the "ImageTile" class is based on.
--- the code
this.BackgroundColor = Color.Maroon;
this.HorizontalOptions = LayoutOptions.FillAndExpand;
this.VerticalOptions = LayoutOptions.FillAndExpand;
this.RowDefinitions.Add (new RowDefinition { Height = new GridLength(0, GridUnitType.Star) });
this.ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength(0, GridUnitType.Star) });
this.RowSpacing = 0;
this.ColumnSpacing = 0;
Image img = new Image ();
img.HorizontalOptions = LayoutOptions.FillAndExpand;
img.VerticalOptions = LayoutOptions.FillAndExpand;
img.Aspect = Aspect.AspectFill;
img.Source = ImageSource.FromUri (new Uri(imageUri));
this.Children.Add (img);
Grid grdInside = new Grid ();
grdInside.HorizontalOptions = LayoutOptions.FillAndExpand;
grdInside.VerticalOptions = LayoutOptions.EndAndExpand; <--- go all the way to the bottom!?!?
grdInside.RowSpacing = 0;
grdInside.Padding = new Thickness (0);
grdInside.ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
Grid grdShading = new Grid ();
grdShading.HorizontalOptions = LayoutOptions.FillAndExpand;
grdShading.VerticalOptions = LayoutOptions.FillAndExpand;
grdShading.BackgroundColor = Color.Black;
grdShading.Opacity = 0.5;
grdShading.Padding = new Thickness (0);
grdShading.ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grdInside.Children.Add (grdShading);
StackLayout slPadding = new StackLayout ();
slPadding.Padding = new Thickness (6,5,6,5);
slPadding.HorizontalOptions = LayoutOptions.FillAndExpand;
slPadding.VerticalOptions = LayoutOptions.FillAndExpand;
slPadding.Spacing = 0;
Label lbl = new Label ();
lbl.TextColor = Color.White;
lbl.Font = Font.SystemFontOfSize (12);
lbl.Text = title;
lbl.VerticalOptions = LayoutOptions.EndAndExpand;
lbl.HorizontalOptions = LayoutOptions.FillAndExpand;
slPadding.Children.Add (lbl);
grdInside.Children.Add (slPadding);
this.Children.Add (grdInside);