Calculate DataGrid height

I have a dataset with more than 200 items. If I use that as dataprovider of a datagrid and set the rowcount to 10 the datagrid is not alway resizing to the right size. Sometimes I see 10.5 rows. This is a nice solution for that problem:

dataGrid.height = measureHeightOfItems(-1, dataGrid.rowCount) + dataGrid.headerHeight;

Author Bio

Leave a reply