Exemple #1
0
        private void DisableEditingControl(bool acceptNewValue)
        {
            if (m_activeEditingControl == null)
                return;

            bool restore = !acceptNewValue;
            if (acceptNewValue)
            {
                var e = new ListViewCellValidatingEventArgs(m_currentRow,m_currentCol, m_activeEditingControl.Text);
                OnCellCellValidating(e);
                if (e.Cancel)
                    restore = true;
                else
                {
                    if (m_activeEditingControl == m_textBox)
                        SetPropertyFromTextBox();
                    else if (m_activeEditingControl == m_comboBox)
                        SetPropertyFromComboBox();
                }
            }
            if (restore)
            {
                if (m_activeEditingControl == m_textBox)
                    SetTextBoxFromProperty();
                else if (m_activeEditingControl == m_comboBox)
                    SetComboBoxFromProperty();
              
            }
            m_activeEditingControl.Leave -= activeEditingControl_Leave;
            m_activeEditingControl.KeyPress -= activeEditingControl_KeyPress;
            if (m_activeEditingControl == m_textBox)
                DisableTextBox();
            else if (m_activeEditingControl == m_comboBox)
                DisableComboBox();
            m_activeEditingControl = null;

            OnCellEndEdit(new ListViewCellEventArgs(m_currentRow, m_currentCol));

            Focus();
        }
Exemple #2
0
 /// <summary>
 /// Method called when cell is being validated</summary>
 /// <param name="e">ListView cell validating event args</param>
 protected void OnCellCellValidating(ListViewCellValidatingEventArgs e)
 {
     if (CellValidating != null)
         CellValidating(this, e);
 }