Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Select first item of un unbound combobox column
posted

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

Parents
  • 69686
    Verified Answer
    posted

    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;
                }

     

    Hope this helps,

    Alex.

Reply Children