0
votes

i have added reference of Xlabs.Forms to my project for circleimage.but it not shape image to round.Please help for how to Implement. My Code is:

xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
<controls:CircleImage Aspect="AspectFill"
                                                  HeightRequest="30"
                                                  HorizontalOptions="Fill"
                                                  Source="Images/05.png"
                                                  WidthRequest="40" />

But it gives rectangle image on ios,Windows Phone Device.

1
Have you added XLAbs.Forms to all platform specific projects or only to pcl? You should add to all of them - Artem Zelinskiy

1 Answers

0
votes

The Xlabs Project have become very monolithic and is not that actively maintained these days (I feel so). If your only requirement for adding XLabs is for Round Image button then I suggest you not to use the XLabs one due to the following reasons :

  1. It increases the size of the apk or ipa significantly.
  2. There might be some compatibility issues with other 3rd party controls you use.

My suggestion is to use the following plugin - Circle Image Control Plugin for Xamarin.Forms created by James Montemagno.

Links :

Usage : In your iOS, Android, and Windows projects call:

Xamarin.Forms.Init();   //platform specific init
ImageCircleRenderer.Init();

XAML :

<controls:CircleImage Source="{Binding Image}" Aspect="AspectFill">
  <controls:CircleImage.WidthRequest>
    <OnPlatform x:TypeArguments="x:Double"
      iOS="55"
      Android="55"
      WinPhone="75"/>
   </controls:CircleImage.WidthRequest>
<controls:CircleImage.HeightRequest>
    <OnPlatform x:TypeArguments="x:Double"
      iOS="55"
      Android="55"
      WinPhone="75"/>
   </controls:CircleImage.HeightRequest>
</controls:CircleImage>