Ignore:
Timestamp:
07/23/13 15:12:10 (9 years ago)
Author:
mkommend
Message:

#2075: Integrated the performed changes in the stable branch.

Location:
stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r9456 r9737  
    5353
    5454    protected override void DeregisterContentEvents() {
     55      Content.ElementNamesChanged -= new EventHandler(Content_ElementNamesChanged);
    5556      Content.ItemChanged -= new EventHandler<EventArgs<int>>(Content_ItemChanged);
    5657      Content.Reset -= new EventHandler(Content_Reset);
     
    6263      Content.ItemChanged += new EventHandler<EventArgs<int>>(Content_ItemChanged);
    6364      Content.Reset += new EventHandler(Content_Reset);
     65      Content.ElementNamesChanged += new EventHandler(Content_ElementNamesChanged);
    6466    }
    6567
     
    9698        dataGridView.Columns[0].Width = dataGridView.Columns[0].GetPreferredWidth(DataGridViewAutoSizeColumnMode.AllCells, true);
    9799      }
     100      UpdateRowHeaders();
     101      dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);
    98102      dataGridView.Enabled = true;
     103    }
     104
     105    protected virtual void UpdateRowHeaders() {
     106      int i = 0;
     107      foreach (string elementName in Content.ElementNames) {
     108        dataGridView.Rows[i].HeaderCell.Value = elementName;
     109        i++;
     110      }
     111      for (; i < dataGridView.RowCount; i++) {
     112        dataGridView.Rows[i].HeaderCell.Value = string.Empty;
     113      }
     114    }
     115
     116    private void Content_ElementNamesChanged(object sender, EventArgs e) {
     117      if (InvokeRequired)
     118        Invoke(new EventHandler(Content_ElementNamesChanged), sender, e);
     119      else
     120        UpdateRowHeaders();
    99121    }
    100122
Note: See TracChangeset for help on using the changeset viewer.