DataGridViewComboBoxCell
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.1.0.0)
Displays an editable ComboBox control in a DataGridViewCell cell when in edit mode.
- C#
- VB.NET
public class DataGridViewComboBoxCell : DataGridViewCell
Public Class DataGridViewComboBoxCell
Inherits DataGridViewCell
Constructors
DataGridViewComboBoxCell()
Initializes a new instance of DataGridViewComboBoxCell.
Properties
AutoCompleteMode
AutoCompleteMode: Returns or sets how automatic completion works for the DataGridViewComboBoxColumn. (Default: None)
Value: One of the values of AutoCompleteMode. The default is None.
CellRenderer
String: Returns the name of the cell renderer to use on the client side to render the cell. If it's null or empty it defaults to "Cell".
The name of the cell renderer can be a fully qualified class name (i.e. "wisej.web.datagrid.cellRenderer.Cell") or just the class name (i.e. "ImageCell") in which case the client library prepends "wisej.web.datagrid.cellRenderer".
CharacterCasing
CharacterCasing: Returns or sets whether the cell editor modifies the case of characters as they are typed. (Default: Normal)
Value: One of the CharacterCasing enumeration values. The default is CharacterCasing.Normal.
DataSource
Object: Returns or sets the data source that contains the possible selections shown in the drop-down list.
Value: An IList or IListSource that contains a collection of values used to supply data to the drop-down list. The default value is null.
Throws:
- ArgumentException The specified value when setting this property is not null and is not of type IList nor IListSource.
DisplayMember
String: Returns or sets the name of the property or column from which to retrieve the text to display in the combo box cell. (Default: "")
Value: A string specifying the name of a property or column in the data source specified in the DataSource property. The default value is Empty, which indicates that the DisplayMember property will not be used.
Throws:
- ArgumentException The DataSource property is not null and the specified value when setting this property is not null or Empty and does not name a valid property or column in the data source.
DropDownStyle
ComboBoxStyle: Returns or sets the style of the combo box. (Default: DropDown)
Value: One of the ComboBoxStyle values. The default is DropDown.
EditType
Type: Returns the type of the cell's hosted editing control.
Value: A Type representing the DataGridViewComboBoxEditingControl type.
IconMember
String: Returns or sets the name of the property or column from which to get the icon to use in the drop-down list. (Default: "")
Value: A string specifying the name of a property or column. The default value is Empty, which indicates that this property is ignored.
Throws:
- ArgumentException The DataSource property is not null and the specified value when setting this property is not null or Empty and does not name a valid property or column in the data source.
IncrementalSelection
Boolean: Returns or sets whether items are selected incrementally as the user types within a timeout of 1 second. (Default: True)
Items
ObjectCollection: Returns the collection of the items contained in this DataGridViewComboBoxCell.
Value: A ObjectCollection containing the items in the DataGridViewComboBoxCell.
LazyLoading
Boolean: Enables or disables lazy loading mode for the ComboBox cell editor control. (Default: False)
MaxInputLength
Int32: Returns or sets the maximum number of characters that can be entered into the editable part of the combo box control. (Default: 0)
Value: The maximum number of characters that can be entered into the text box; the default value is 0 (unlimited).
Throws:
- ArgumentOutOfRangeException The value is less than 0.
Sorted
Boolean: Returns or sets if the items in the combo box editor are automatically sorted. (Default: False)
Value: true if the combo box is sorted; otherwise, false. The default is false.
Throws:
- ArgumentException An attempt was made to sort a cell that is attached to a data source.
Tools
ComponentToolCollection: Returns the instance of ComponentToolCollection associated with this cell.
ValueMember
String: Returns or sets the name of the property or column from which to get the value that correspond to the selections in the drop-down list. (Default: "")
Value: A string specifying the name of a property or column. The default value is Empty, which indicates that this property is ignored.
Throws:
- ArgumentException The DataSource property is not null and the specified value when setting this property is not null or Empty and does not name a valid property or column in the data source.
ValueType
Type: Returns or sets the data type of the values in the cell.
Value: A Type representing the data type of the value in the cell.
VirtualScroll
Boolean: Enables or disables virtual scrolling mode for the ComboBox cell editor control. (Default: False)
Watermark
String: Returns or sets the text to show when the control is empty.
Methods
GetFormattedValue(value, cellStyle, valueTypeConverter, formattedTypeConverter)
Returns the value of the cell formatted to be displayed on the client.
| Parameter | Type | Description |
|---|---|---|
| value | Object | The value to be formatted. |
| cellStyle | DataGridViewCellStyle | The DataGridViewCellStyle in for the cell. |
| valueTypeConverter | TypeConverter | A TypeConverter providing custom conversion from the formatted type to the value type, or null if no custom conversion is required. |
| formattedTypeConverter | TypeConverter | A TypeConverter providing custom conversion from the value type to the formatted type, or null if no custom conversion is required. |
Returns: Object. The value of the cell or null if the cell does not belong to a DataGridView control.
Throws:
- Exception Formatting failed and there is no handler for the DataError event of the DataGridView or the handler set the ThrowException property to true.
InitializeEditingControl(editor, style)
Initializes the control used to edit the cell.
| Parameter | Type | Description |
|---|---|---|
| editor | Control | The Control that is used to edit the cell. |
| style | DataGridViewCellStyle | The DataGridViewCellStyle that is in effect for the cell entering edit mode. |
Throws:
- ArgumentNullException editor is null.
OnDataGridViewChanged()
Called when the element is associated with a different DataGridView.
OnItemsCollectionChanged(e)
Fires the CollectionChanged event.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs |
ParseFormattedValue(value, cellStyle, formattedTypeConverter, valueTypeConverter)
Converts a value to the actual cell value.
| Parameter | Type | Description |
|---|---|---|
| value | Object | The display value of the cell. |
| cellStyle | DataGridViewCellStyle | The DataGridViewCellStyle in effect for the cell. |
| formattedTypeConverter | TypeConverter | A TypeConverter for the display value type, or null to use the default converter. |
| valueTypeConverter | TypeConverter | A TypeConverter for the cell value type, or null to use the default converter. |
Returns: Object. The cell value.
Throws:
- ArgumentNullException cellStyle is null.
- FormatException The FormattedValueType property value is null or the ValueType property value is null or value cannot be converted.
- ArgumentException value is null or the type of value does not match the type indicated by the FormattedValueType property.
Events
ItemsCollectionChanged
EventHandler Fired when the collection changes.
Implements
| Name | Description |
|---|---|
| IUserData | Provides access to the UserData and Tag properties associated to the component implementing this interface. |
| ICommandSource | Defines an object that can invoke a Command. |