Exemplo n.º 1
0
        private void DrawData(ref int rowIndex)
        {
            _controls = new List <Pair <Label, ITypeBinder> >();

            //TextBoxHint keyHint = new TextBoxHint();
            //keyHint.IsReadonly = true;

            bool showConnector = (!string.IsNullOrEmpty(_hint.ConnectorLabel));
            Dictionary <string, IEnumerable <string> > kvHints = _hint.KeyValueHints;
            ITypeBinder valueBinder = null;

            foreach (KeyValuePair <string, string> kv in _dictionary)
            {
                _overarchingPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize));

                //TextBoxBinder keyBinder = new TextBoxBinder(kv.Key, keyHint);
                //_overarchingPanel.Controls.Add(keyBinder.Control, 0, rowIndex);
                Label lbl = AddLabel(kv.Key, rowIndex, 0);

                if (showConnector)
                {
                    AddLabel(_hint.ConnectorLabel, rowIndex, 1);
                }

                if (kvHints != null && kvHints.ContainsKey(kv.Key))
                {
                    valueBinder = new ComboBoxBinder(kv.Value, kvHints[kv.Key], ComboBoxStyle.DropDown);
                }
                else
                {
                    valueBinder = new TextBoxBinder(kv.Value, null);
                }
                _overarchingPanel.Controls.Add(valueBinder.Control, 2, rowIndex);

                _controls.Add(new Pair <Label, ITypeBinder>(lbl, valueBinder));
                rowIndex++;
            }
        }
Exemplo n.º 2
0
        private void OnNew(object sender, EventArgs e)
        {
            _overarchingPanel.SuspendLayout();

            _overarchingPanel.Controls.Remove(_btnNew);

            TextBoxBinder keyBinder = new TextBoxBinder("...", null);

            _overarchingPanel.Controls.Add(keyBinder.Control, 0, _newRowIndex);

            if (!string.IsNullOrEmpty(_hint.ConnectorLabel))
            {
                AddLabel(_hint.ConnectorLabel, _newRowIndex, 1);
            }

            TextBoxBinder valueBinder = new TextBoxBinder();

            _overarchingPanel.Controls.Add(valueBinder.Control, 2, _newRowIndex);

            _newRowIndex++;
            _overarchingPanel.Controls.Add(_btnNew, 0, _newRowIndex);

            _overarchingPanel.ResumeLayout();
        }