Example #1
0
        private void _btnRemove_Click(object sender, EventArgs e)
        {
            if (DataSource == null)
            {
                return;
            }

            CalcFieldItem cfi = GetSelectedItem();

            if (cfi != null)
            {
                int idx = cfi.Index;
                this.DataSource.CalculatedFields.Remove(cfi.Field);
                _lvCalculatedFields.Items.Remove(cfi);
                _lvCalculatedFields.Focus();
                if (idx >= _lvCalculatedFields.Items.Count)
                {
                    --idx;
                }
                if (idx >= 0)
                {
                    _lvCalculatedFields.Items[idx].Selected = true;
                }
            }
        }
Example #2
0
        private void _lvCalculatedFields_SelectedIndexChanged(object sender, EventArgs e)
        {
            CalcFieldItem cfi = GetSelectedItem();

            _propGrid.SelectedObject = cfi != null?EditorsHelper.CreateInstanceModel(cfi.Field, DesignerHostServices) : null;

            _btnRemove.Enabled = cfi != null;
        }