Skip to content

Instantly share code, notes, and snippets.

@tientham
Created August 13, 2019 19:41
Show Gist options
  • Save tientham/7867e6c39b5bc49e46da89f29bc1dfdb to your computer and use it in GitHub Desktop.
Save tientham/7867e6c39b5bc49e46da89f29bc1dfdb to your computer and use it in GitHub Desktop.
Achieve an rounded card with image as background in xamarin forms
There are 2 ways:
1- Frame and Image
<Frame CornerRadius="10" Margin="0" Padding="0" IsClippedToBounds="True" HasShadow="false">
<Image Source="{Binding Picture}" Aspect="AspectFill" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
</Frame>
2- FFImageLoading
<ffimageloading:CachedImage HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
Aspect="AspectFill" DownsampleToViewSize="true" Source = "{Binding Picture}">
<ffimageloading:CachedImage.Transformations >
<fftransformations:CornersTransformation
CornersTransformType="AllRounded"
BottomLeftCornerSize="10" TopLeftCornerSize="10"
TopRightCornerSize="10" BottomRightCornerSize="10"/>
</ffimageloading:CachedImage.Transformations>
</ffimageloading:CachedImage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment