Forum Xamarin.Forms

how to bind viewcell heigh to its content

msjjdmsjjd USMember ✭✭

                <StackLayout Padding="20,15,0,0" VerticalOptions="StartAndExpand" Orientation="Vertical">

                    <Label  Text="{Binding UserName}"  />
                    <Label  Text="{Binding AuthorizeUserName}"  />
                    <Image  Source="{Binding Image}" />
                    <Label  Text="{Binding ProductName}"/>
                    <Label  Text="{Binding Weight}"/>
                    <Label  Text="{Binding Description}"/>



I need to bind my view cell height to size of the stacklayout. my items size is more than viewcell height and they are out of the row.


  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    HasUnevenRows property?
  • msjjdmsjjd USMember ✭✭
    edited April 2018

    HasUnevenRows = true makes it better, but my contents are bigger than rows

  • jonathannicholsjonathannichols USMember ✭✭

    You can dynamically set ViewCell Height using below...
    private void ViewCell_Appearing(object sender, EventArgs e)
    double rowHeight = 0;
    if (gridRowHeight < 1)
    rowHeight = QuestionairContainer.Height / 6;
    ((ViewCell)sender).Height = rowHeight;

  • AsurAsur USMember ✭✭✭

    @msjjd am quite late but still , Were you able to resolve it ?

Sign In or Register to comment.