Forum Xamarin.Forms

AbsoluteLayout. Seems simple but oh so hard to implement :-(

Hi Guys,
I have a simple listview with some text and an image.... but cant seem to make AbsoluteLayout work for the image(s). [i need it/them vertically centered within each cell and right aligned].
Is there some sort of magic trick to make this work (see image).
Thanks :-)

                <StackLayout Orientation="Vertical" Padding="10,10,15,10">
                    <Label Text="{Binding Name}" FontSize="18" FontAttributes="Bold" TextColor="Black"/>
                    <Label Text="{Binding Path}" FontSize="9"/>
                    <AbsoluteLayout BackgroundColor="Maroon" AbsoluteLayout.LayoutBounds="1,0,.5,.1" AbsoluteLayout.LayoutFlags="All">
                            <Image Source="{Binding Image}" />

Best Answer


  • Oh so close :-)

        <StackLayout Orientation="Vertical" Padding="10,10,15,10">
            <Grid Padding="0" RowSpacing="0" ColumnSpacing="0">
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="20" />
                <Label Text="{Binding Name}" FontSize="18" FontAttributes="Bold" TextColor="Black" Grid.Column="0"/>
                <Image Source="{Binding Image}" HorizontalOptions="End" Grid.Column="1" WidthRequest="20" MinimumWidthRequest="20"/>    
Sign In or Register to comment.