private void addHypothesis(Hypothesis hypothesis) { HypothesisTabControl Hypothesis = new HypothesisTabControl(hypothesis); Hypothesis.Dock = DockStyle.Top; Hypothesis.Height = 55; Hypothesis.Visible = true; Hypothesis.PropertyChanged += PropretyChanged; this.panelSurveyTableContent.Controls.Add(Hypothesis); this.panelSurveyTableContent.Controls.SetChildIndex(Hypothesis, 0); }
private void PropretyChanged(object o, PropertyChangedEventArgs e) { if (o != null) { HypothesisTabControl hypothesisTabControl = (HypothesisTabControl)o; this.viewModel.hypotheses.Remove(hypothesisTabControl.viewModel.hypothesis); this.panelSurveyTableContent.Controls.Clear(); int i = 0; foreach (Hypothesis hypothesis in viewModel.hypotheses) { hypothesis.number = i; i++; } loadHypotheses(); } }