jamesmontemagno / ImageCirclePlugin

Circle Images for your Xamarin.Forms Applications
MIT License
240 stars 68 forks source link

Bindable BorderThickness from xaml #85

Closed erdugen closed 5 years ago

erdugen commented 5 years ago

Hi, I don't use OnPlatform for BorderThickness in xaml. Builder give error. Error is : No property, bindable property or event found for "BorderThickness" or mismatching type between value and property. Thanks...

Version Number of Plugin: 3.0 Device Tested On: IOS and Android Simulator Tested On: Version of VS: For Mac 8.0.3 (build 14) Version of Xamarin: 3.6.0.29 Versions of other things you are using:

Code snippet

                        <cimg:CircleImage Grid.Column="0"
                                          Grid.Row="0"
                                          Grid.RowSpan="3"
                                          BorderColor="White"
                                          HeightRequest="40"
                                          WidthRequest="40"
                                          Source="{Binding ImageSource}"
                                          HorizontalOptions="CenterAndExpand"
                                          VerticalOptions="CenterAndExpand"
                                          Aspect="AspectFill">
                            <cimg:CircleImage.BorderThickness>
                                <OnPlatform x:TypeArguments="x:Double">
                                    <On Platform="iOS">3</On>
                                    <On Platform="Android">1</On>
                                </OnPlatform>
                            </cimg:CircleImage.BorderThickness>
                        </cimg:CircleImage>

Screenshots

jamesmontemagno commented 5 years ago

That is because it is a Float https://github.com/jamesmontemagno/ImageCirclePlugin/blob/master/src/ImageCircle/CircleImage.shared.cs#L25

jamesmontemagno commented 5 years ago

Also you can just use:

 <cimg:CircleImage Grid.Column="0"
                                          Grid.Row="0"
                                          Grid.RowSpan="3"
                                          BorderColor="White"
                                          HeightRequest="40"
                                          WidthRequest="40"
                                          Source="{Binding ImageSource}"
                                          HorizontalOptions="CenterAndExpand"
                                          VerticalOptions="CenterAndExpand"
                                          BorderThickness="{OnPlatform iOS=3, Android=1}"
                                          Aspect="AspectFill">
erdugen commented 5 years ago

I learned something new from you. thanks :)