I'm a XamDataGrid with un unbound combobox column, and the ItemsSource is filled dynamically using linq.
Everything it's ok, but I must to pre-select the first item of the comboboxEditor, something like
cboXX.SelectedIndex = 0;
But I can't found how to do it with the combobox column / editor.
Any ideas?
Marcos
Hello,
Have you tried to wire and handle the Loaded event of the XamComboEditor (the one in the ControlTemplate of the CellValuePresenter with <EventSetter.../> or with the EventManager class).
Hope this helps,
Alex.
My question is so select a item in that combobox when the datagrid is beeing initializing.
I tried to get the editor from the cell in the InitializeRecord event but it's not there YET.
After initialize and subscribe to the cellchanged event, the editor (xamcomboeditor) is now indeed to resolve, including the selected value.
Any ideas on this?
Thanks a lot Alex, it's exactly what I was looking for.
Hello Marcos,
Here is one way to do this:(I do this in the Click event of a button)
foreach (DataRecord record in xamDataGrid1.Records) { CellValuePresenter cvp = CellValuePresenter.FromCell(record.Cells[INDEX]); XamComboEditor editor = cvp.Editor as XamComboEditor; editor.SelectedIndex = 0; }