Exemple #1
0
        private void recalcRowHeightForMergeRequestListView()
        {
            if (Items.Count == 0)
            {
                return;
            }

            int getMaxRowCountInColumn(string columnName)
            {
                int labelsColumnIndex     = getColumnByTag(columnName).Index;
                IEnumerable <string> rows = Items.Cast <ListViewItem>()
                                            .Select(item => ((ListViewSubItemInfo)(item.SubItems[labelsColumnIndex].Tag)).Text);
                IEnumerable <int> rowCounts = rows
                                              .Select(thing => thing.Count(y => y == '\n'));

                return(rowCounts.Max() + 1);
            }

            int maxLineCount = Math.Max(getMaxRowCountInColumn("Labels"), getMaxRowCountInColumn("Author"));

            WinFormsHelpers.SetListViewRowHeight(this, maxLineCount);
        }