Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

ListView Row Height

$
0
0

Hi guys.

I have a ListView with HasUnevenRows = true.

I bind ItemSource to an ObservableCollection.

This Collection fill the ListViews with some rows. Each row has a different height because the text is different from row to row.

I would like to know if I can know which is the Height of each row.

Thanks
Alessandro

                IEnumerable<PropertyInfo> pInfos = (ListViewPrivacy as ItemsView<Cell>).GetType().GetRuntimeProperties();
                var templatedItems = pInfos.FirstOrDefault(info => info.Name == "TemplatedItems");
                if (templatedItems != null)
                {
                    var cells = templatedItems.GetValue(ListViewPrivacy);
                    foreach (ViewCell cell in cells as Xamarin.Forms.ITemplatedItemsList<Xamarin.Forms.Cell>)
                    {

                        if (cell.BindingContext != null)
                        {

                            System.Diagnostics.Debug.WriteLine("CellHeight = " + cell.Height + " - " + cell.RenderHeight + " " + cell.View.Height + " - " + cell.View.HeightRequest + " - " + cell.View.MinimumHeightRequest + " - " );
                            Grid grid = (Grid)cell.View;
                            System.Diagnostics.Debug.WriteLine("Height = " +  grid.Height.ToString() + " - " + grid.HeightRequest + " - " + grid.MinimumHeightRequest);


                        }
                    }
                }

I have tried with a code like this but I have always "-1" in each property


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>