C1.Win.C1FlexGrid Namespace > C1FlexGridBase Class : Editor Property |
'Declaration
<C1DescriptionAttribute("Gets or sets a reference to the cell editor that is currently active.")> <BrowsableAttribute(False)> <DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)> Public Property Editor As Control
'Usage
Dim instance As C1FlexGridBase Dim value As Control instance.Editor = value value = instance.Editor
[C1Description("Gets or sets a reference to the cell editor that is currently active.")] [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public Control Editor {get; set;}
[C1Description("Gets or sets a reference to the cell editor that is currently active.")] [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public: property Control^ Editor { Control^ get(); void set ( Control^ value); }
The Editor property returns a reference to the cell editor that is currently active. This may be one of the built-in editors (a TextBox, a ComboBox, or a DateTimePicker control), a custom editor, or null (if the grid is not in edit mode).
You can use this property to programmatically access the editor, or to find out if the grid is in edit mode.
If you don't want to use the grid's built-in editors, you can use any other control instead. To do this, either associate the external editor with a specific grid row, column, or CellStyle using the CellStyle.Editor property, which you can get and set at any time.
Alternatively, you can handle the StartEdit event and assign any control directly to the Editor property. (Note that the grid's Editor property can only be assigned while handling the StartEdit event, and is automatically reset to null when the grid exits edit mode.)
Any control can be used as an external editor, but to achieve complete integration with the grid, the external editor should implement the IC1EmbeddedEditor interface. Some controls implement this interface natively and don't require any extra code to be used as grid editors (like the ones in the C1Input library). Most, however, will require you to implement at least a few of the methods in IC1EmbeddedEditor.
For examples of custom editors, please see Using Custom Editors and Creating Custom Editors in this documentation, or visit our on-line sample library at http://helpcentral.componentone.com/ProductResources.aspx and download the "CustomEditors" sample.
void _flex_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { TextBox tb = _flex.Editor as TextBox; if (tb != null) { tb.CharacterCasing = CharacterCasing.Upper; tb.MaxLength = 12; } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2