Is there a way to change the default editor for Dates in UltrawinGrid?
I do not want to display the monthcalendar editor. I simply want it to appears as a text field.
I am trying the following code but it doesn't seem to override it. The calendar control still appears.
Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles UltraGrid1.InitializeRow 'Create the Settings Object: Dim theSettings As New DefaultEditorOwnerSettings 'as well as the Editor Owner: Dim theOwner As New DefaultEditorOwner(theSettings) Dim theEditor As EmbeddableEditorBase = Nothing For Each gridCell As Infragistics.Win.UltraWinGrid.UltraGridCell In e.Row.Cells Dim theValue As Object = gridCell.Value 'Create an appropriate editor based on the 'Value's Data Type: If TypeOf theValue Is Boolean Then theSettings.DataType = GetType(Boolean) theEditor = New CheckEditor(theOwner) ElseIf TypeOf theValue Is Color Then theSettings.DataType = GetType(Color) theEditor = New ColorPickerEditor(theOwner) ElseIf TypeOf theValue Is String Then theSettings.DataType = GetType(String) theEditor = New EditorWithText(theOwner) ElseIf TypeOf theValue Is DateTime Then theSettings.DataType = GetType(DateTime) theEditor = New EditorWithText(theOwner) End If Next 'Assign it to the Cell.Editor e.Row.Cells(0).Editor = theEditor End Sub
FYI I am also override the CellClickAction to do a rowselect because I do not want the user to be able to select/edit any cell value.
Is there any way to set a global override for the default editor rather than on row initialize?
Thanks In Advance!
Hi,
I don't see any reason why the code you have here should not work, but in any case, this is extremely inefficient. I'm not sure why you are using InitializeRow for this - unless your column DataType is object and you have different data types in each cell of the same column.
Typically, all of the cell in a column are the same type, so you could simply use the InitializeLayout event and examine the DataType of the column and set the Editor on the that. Or better yet, set the Style property on the column.