Gan
Gan

Reputation: 71

Button in the image XamarinForms

I have an image that I can scroll horizontally and I need to put a button on the image that will still be in the same position even if I scroll the image. Like this

My code:

<StackLayout>
    <Button WidthRequest="30" HeightRequest="30" BorderRadius="20" HorizontalOptions="Start" />
    <ScrollView Orientation="Horizontal" >
        <Image HorizontalOptions="Center" VerticalOptions="Center" Source="mapasveta.png" />
    </ScrollView>
</StackLayout>

Upvotes: 1

Views: 46

Answers (1)

Muhammad Adeel Shoukat
Muhammad Adeel Shoukat

Reputation: 345

Use Grid with no Row and now Columns now the button will overlap on ScrollView.

<StackLayout>
    
<Grid>
    <ScrollView Orientation="Horizontal" >
        <Image HorizontalOptions="Center" VerticalOptions="Center" Source="mapasveta.png" />
</ScrollView>
<Button WidthRequest="30" HeightRequest="30" BorderRadius="15" HorizontalOptions="Start" VerticalOptions="Start"
 Margin="15"/>
</Grid>
    
</StackLayout>

Upvotes: 1

Related Questions