Example #1
0
 /// <summary>
 /// Attaches and initializes the hosted editing control.
 /// </summary>
 /// <param name="rowIndex">The index of the row being edited.</param>
 /// <param name="initialFormattedValue">The initial value to be displayed in the control.</param>
 /// <param name="dataGridViewCellStyle">A cell style that is used to determine the appearance of the hosted control.</param>
 public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
 {
     base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
     if (DataGridView.EditingControl != null)    // This should not be needed, but just in case...
     {
         celleditcontrol      = DataGridView.EditingControl as CellEditControl;
         celleditcontrol.Text = (string)(Value ?? DefaultNewRowValue);
         if (OwningColumn != null && ((ExtDataGridViewColumnAutoComplete)OwningColumn).AutoCompleteGenerator != null)
         {
             celleditcontrol.SetAutoCompletor((OwningColumn as ExtDataGridViewColumnAutoComplete).AutoCompleteGenerator);
         }
     }
 }
            /// <summary>
            /// Attaches and initializes the hosted editing control.
            /// </summary>
            /// <param name="rowIndex">The index of the row being edited.</param>
            /// <param name="initialFormattedValue">The initial value to be displayed in the control.</param>
            /// <param name="dataGridViewCellStyle">A cell style that is used to determine the appearance of the hosted control.</param>
            public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
            {
                System.Diagnostics.Debug.WriteLine("Init editing control");
                base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
                if (DataGridView.EditingControl != null)    // This should not be needed, but just in case...
                {
                    System.Diagnostics.Debug.WriteLine("Cell value " + Value);
                    celleditcontrol      = DataGridView.EditingControl as CellEditControl;
                    celleditcontrol.Text = (string)(Value ?? DefaultNewRowValue);

                    // hook autocompleter from column to cell
                    if (OwningColumn != null && ((ExtDataGridViewColumnAutoComplete)OwningColumn).AutoCompleteGenerator != null)
                    {
                        celleditcontrol.SetAutoCompletor((OwningColumn as ExtDataGridViewColumnAutoComplete).AutoCompleteGenerator);
                    }
                }
            }
Example #3
0
            /// <summary>
            /// Attaches and initializes the hosted editing control.
            /// </summary>
            /// <param name="rowIndex">The index of the row being edited.</param>
            /// <param name="initialFormattedValue">The initial value to be displayed in the control.</param>
            /// <param name="dataGridViewCellStyle">A cell style that is used to determine the appearance of the hosted control.</param>
            public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
            {
                base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
                var ctl = DataGridView.EditingControl as CellEditControl;

                if (ctl != null)    // This should not be needed, but just in case...
                {
                    _ctl = ctl;
                    if (Value == null)
                    {
                        ctl.Text = (string)DefaultNewRowValue;
                    }
                    else
                    {
                        ctl.Text = (string)Value;
                    }
                    var col = OwningColumn as AutoCompleteDGVColumn;
                    if (col != null && col.AutoCompleteGenerator != null)
                    {
                        ctl.SetAutoCompletor(col.AutoCompleteGenerator);
                    }
                }
            }