Hi:
I have a xamdatagrid, and I want to show different editor depending the data value form a column, it can be combobox, calendarcontrol etc. . and the combobox value it dynamics in get it runtime from an unbound array.
How to do it?
Regards,
Joel
I am trying to use the code like following, however, when debugging the dr always pointing to the first record. I am not able to loop thru' the records!!
private void dgRptField_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e) {
DataRecord dr = (DataRecord)e.Record; string theValue = (string)dr.Cells["Type"].Value.ToString()
................ }
You can port that to WPF just setting the EditorType/ EditorStyle properties of the cell in the InitializeRecord event.
Hi Actually I am doing this in UltraWinGrid, now i want to port to WPF, and I can do it in WinForm.
void ugSelField_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { ValueList valuelist; string theValue = e.Row.Cells["Type"].Value.ToString().Substring(0,4); switch (theValue.ToUpper()) { case "ENUM": string[] ItemList = e.Row.Cells["TypeString"].Value.ToString().Split(':'); valuelist = new ValueList(); for (int p = 0; p < ItemList.Length; p=++ ) { valuelist.ValueListItems.Add(ItemList[p]); } e.Row.Cells["D"].ValueList = valuelist; e.Row.Cells["D"].Editor = new EditorWithCombo();
break; case "DATE": e.Row.Cells["D"].Editor = new DateTimeEditor(); break;
} }
Anyone can do it?
Hello Joe,
To the best of my knowledge, you will not be able to do that without rebinding the XamDataGrid. The ValueEditors in a cell cannot be changed runtime. You can do that by rebinding it and handling the InitializeRecord event and change the EditorType of the specific field.
Hope this helps.