1

I have this image:

var logoImage = new Image () 
{ 
    HorizontalOptions = LayoutOptions.StartAndExpand,  
    VerticalOptions = LayoutOptions.FillAndExpand, 
    Aspect = Aspect.AspectFit
};

But it is not stretched vertically. Result here: Image

If I remove the HorizontalOptions all will work out well. However, the image will be centered , but i need the left side.

P.S. The image is in Grid.

   public class TopMenu:Grid
    {
        public TopMenu ()
        {
            this.HeightRequest = 40;
            this.Padding = 0;

            this.BackgroundColor = Color.FromRgb (255, 146, 0);

        var logoImage = new Image () { Source = ImageSource.FromResource ("***.Images.TopMenu.logo_new.gif"),  
        HorizontalOptions = LayoutOptions.StartAndExpand,  
        VerticalOptions = LayoutOptions.FillAndExpand, 
        Aspect = Aspect.AspectFit };

            this.Children.Add (logoImage);
        }
    }
Jan
  • 19
  • 8
  • Have a look at this. It may helps you to figure out what's wrong in your case: http://stackoverflow.com/questions/25338533/what-is-the-difference-between-xamarin-forms-layoutoptions-especially-fill-and – Wosi Nov 03 '15 at 11:25
  • It did not help me. Either I do not understand something . – Jan Nov 03 '15 at 12:28
  • 1
    Is the `Image` inside a container. I.e. is it inside a `StackLayout` if so can you please post the code of that – JKennedy Nov 03 '15 at 14:20
  • I tried different methods , did not work out. I wrote the code . – Jan Nov 03 '15 at 14:32
  • Have you tried "this.VerticalOptions = LayoutOptions.FillAndExpand"? for the grid I mean, maybe the problem is not the image, but the grid containing it – dsnunez Nov 03 '15 at 16:39

0 Answers0