Example #1
0
        /// <summary>
        /// Add a row with its presenter and initialize the view.
        /// </summary>
        public void AddRow()
        {
            var v = new AlternateRowControl();
            var p = presenter.GetRowPresenter(v);

            v.TabIndex = 0;
            v.Init(p);
            v.AddToLayoutPanel(layoutPanel);
            presenter.SubsribeRowEventHandlers(v);
            UpdateRemoveBtnEnabled();
        }
        public static void AddToLayoutPanel(this AlternateRowControl row, TableLayoutPanel p)
        {
            if (!(p.RowCount == 1 && p.Controls.Count == 0))
            {
                // Before initialization finished, p has one row but no AltenateRowControl
                // is added to p.

                p.RowCount += 1;
            }

            p.Controls.Add(row, 0, p.RowCount - 1);
            p.RowStyles.Add(new RowStyle(SizeType.AutoSize));
        }