Forum General

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to set an image inside image using AbsoluteLayout

Ranamuhammad.1569Ranamuhammad.1569 USMember ✭✭✭

Hi all i want to set an image inside image in AbsoluteLayout but it didn't fill the view

<AbsoluteLayout WidthRequest="250" HeightRequest="250" Margin="0,10,0,0">

                                    <AbsoluteLayout.GestureRecognizers>
                                        <TapGestureRecognizer CommandParameter="{Binding MyImage}" Tapped="Popup_TapGestureRecognizer_Tapped" />
                                    </AbsoluteLayout.GestureRecognizers>

                                    <Grid AbsoluteLayout.LayoutBounds="1,1,1,1" AbsoluteLayout.LayoutFlags="All">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="245"/>
                                        </Grid.ColumnDefinitions>

                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="{x:OnPlatform Android='210', iOS='240'}"/>
                                        </Grid.RowDefinitions>

                                        <Image x:Name="myImage" IsEnabled="True"
                                           Grid.Row="0" Grid.Column="0" Aspect="Fill" 
                                           Source="{Binding MyFrame}"></Image>
                                    </Grid>

                                    <Grid AbsoluteLayout.LayoutBounds="0.1, 0.1, 0.9, 0.8" AbsoluteLayout.LayoutFlags="All">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <RelativeLayout>
                                            <Image Source="{Binding MyImage}"
               Aspect="AspectFill" HorizontalOptions="FillAndExpand" 
               VerticalOptions="FillAndExpand"
               RelativeLayout.WidthConstraint=
                     "{ConstraintExpression Type=RelativeToParent,
                                            Property=Width,
                                            Factor=1}"
                 RelativeLayout.HeightConstraint=
                     "{ConstraintExpression Type=RelativeToParent,
                                            Property=Height,
                            Factor=1}">
                                            </Image>
                                        </RelativeLayout>
                                    </Grid>
                                </AbsoluteLayout>

Tagged:

Answers

Sign In or Register to comment.