Forum Xamarin.Forms

Set RowSpan with Converter

NikosGNikosG DEMember ✭✭

Hello guys,

I would like to have uneven rows in my ListView... what I do is to set the



<Label Grid.Row="0" Grid.RowSpan="{Binding Description, Converter={StaticResource ConverterHasValueToRowSpan}}" Text="asd"/>

and follows the converter:

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        if (value == null)
            return int.Parse("0");

        return string.IsNullOrEmpty(value.ToString()) ? int.Parse("2") : int.Parse("0");

I also tried without the integer parsing and I still get the error message:

Value was an invalid value for RowSpan. Parameter name: value

Can anyone help? It seems to me that I didn't forgot something.


  • shrung_bhattshrung_bhatt Member

    Too late for an answer, but maybe it might be of some help to people passing by.
    While binding a Grid's row span property there are few things that we need to keep in mind
    1. The RowSpan binding property is of Int32.
    2. The value of this binding property must never be zero. It should be >=1.

Sign In or Register to comment.