Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4798


Ignore:
Timestamp:
11/15/10 15:26:51 (14 years ago)
Author:
mkommend
Message:

Fixed updating of StringConvertibleMatrixView if the number of columns gets changed (ticket #1266).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r4779 r4798  
    134134      else
    135135        dataGridView.ColumnCount = Content.Columns;
     136
    136137      ClearSorting();
    137138
     
    145146
    146147    protected void UpdateColumnHeaders() {
    147       HashSet<string> visibleColumnNames = new HashSet<string>(dataGridView.Columns.OfType<DataGridViewColumn>()
    148           .Where(c => c.Visible && !string.IsNullOrEmpty(c.HeaderText)).Select(c => c.HeaderText));
    149       if (!visibleColumnNames.Intersect(Content.ColumnNames).Any())
    150         visibleColumnNames.Clear();
     148      HashSet<string> invisibleColumnNames = new HashSet<string>(dataGridView.Columns.OfType<DataGridViewColumn>()
     149      .Where(c => !c.Visible && !string.IsNullOrEmpty(c.HeaderText)).Select(c => c.HeaderText));
    151150
    152151      for (int i = 0; i < dataGridView.ColumnCount; i++) {
     
    155154        else
    156155          dataGridView.Columns[i].HeaderText = "Column " + (i + 1);
    157       }
    158 
    159       foreach (DataGridViewColumn column in dataGridView.Columns)
    160         column.Visible = visibleColumnNames.Contains(column.HeaderText) || visibleColumnNames.Count == 0;
     156        dataGridView.Columns[i].Visible = !invisibleColumnNames.Contains(dataGridView.Columns[i].HeaderText);
     157      }
    161158    }
    162159    protected void UpdateRowHeaders() {
Note: See TracChangeset for help on using the changeset viewer.