Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Change Height in ViewCell

I'm trying to change ViewCell on listview, but the code below not work for me:

<DataTemplate>
    <ViewCell Height="100">
        <StackLayout Orientation="Horizontal">
            <Image Source="{Binding Seller.Thumbnail}}" Aspect="AspectFit" />
            <StackLayout Orientation="Vertical" >
                <Label Text="{Binding CouponName}" FontAttributes="Bold" FontSize="12" />
                <Label Text="{Binding EndOffer}" FontSize="11" />
            </StackLayout>
        </StackLayout>
    </ViewCell>
</DataTemplate>
like image 362
One Brasil Mídia Interativa Avatar asked Jun 07 '15 17:06

One Brasil Mídia Interativa


People also ask

How to change the height of Tableview cell in iOS dynamically?

To change the height of tableView cell in ios dynamically, i.e resizing the cell according to the content available, we’ll need to make use of automatic dimension property. We’ll see this with the help of an sample project. Create an empty project and go to it’s viewController class, conform it to UITableViewDataSource and UITableViewDelegate.

Is it possible to change the height of a stacklayout view cell?

However , you can change your StackLayout's HeightRequest property to achieve what you want. "generally" being the key term here. In the case of ViewCell however it is get/set. If you look at the intellisense that pops up on that property in Visual Studio this is confirmed.

How to set the height of a viewcell in listview?

If you want to set ViewCell.Height instead then set ListView.HasUnevenRows to true (but it has some performance impact) Setting the height for the ViewCell will work only if ListView.HasUnevenRows or TableView.HasUnevenRows property set to true. True, but see Daniel Luberda's more complete answer above, which already said this.

What does setting the height of a cellview do?

So setting the .Height of a CellView can appear to to not have any affect. It is primarily meant to be used in conjunction with ListVIew.HasUnevenRows=true


2 Answers

  • If all cells have the same size set ListView.RowHeight property on ListView itself
  • If you want to set ViewCell.Height instead then set ListView.HasUnevenRows to true (but it has some performance impact)
like image 97
Daniel Luberda Avatar answered Oct 20 '22 18:10

Daniel Luberda


The correct now in 2019 is put this for fix height:

<ListView RowHeight="100" />

If yout don't want fix height in all rows, use:

<ListView HasUnevenRows="true" />
like image 14
Anton Nikolayevich Avatar answered Oct 20 '22 20:10

Anton Nikolayevich