Forum Xamarin.Forms


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 access the Corner Radius Property In IValueConverter ?

My Custom Renderer for Corner Radius is ...
public class ContentViewRoundedCorners : StackLayout
public static readonly BindableProperty CornerRaidusProperty =
BindableProperty.Create<ContentViewRoundedCorners, float>(x => x.CornerRadius, 15);

    public float CornerRadius
        get { return (float)GetValue(CornerRaidusProperty); }
        set { SetValue(CornerRaidusProperty, value); }

And My IValue Converter code is ..
public class StripedBackgroundIndexConverter : IValueConverter

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        if (value == null || parameter == null) return Color.White;
        var index = ((ListView)parameter).ItemsSource.Cast<object>().ToList().IndexOf(value);

        var counterlistview = ((ListView)parameter).ItemsSource.Cast<object>().ToList().Count-1;

        // return index  == counterlistview ?  //How to check the corner radius here ...  ;

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        throw new NotImplementedException();

Now the question is how to access the corner radius in the conditional statement give above in the IValueConverter portion ?

Best Answer


Sign In or Register to comment.