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
490
Populating combobox on new row
posted

I have a field in my grid defined as:

<igDP:Field Name="Exception">
  <igDP:Field.Settings>
    <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" >
      <igDP:FieldSettings.EditorStyle>
        <Style TargetType="{x:Type igEditors:XamComboEditor}">
          <Setter Property="ItemsProvider" Value="{Binding DataItem.MarkupExceptionTypeProvider}"/>
        </Style>
      </igDP:FieldSettings.EditorStyle>
    </igDP:FieldSettings>
  </igDP:Field.Settings>
</igDP:Field>

 

As you can see, the comboBox ItemsProvider is bound to a property on my view model.  The grid is set up to allow adding new rows.

The problem is that the comboBox in the new row is not actually populated until something is typed into the row.  So if I type something in the cell, the comboBox populates.  If I use the mouse to just open the drop down, it remains empty.

It looks like the object is not created until a field on the row changes.  Is there any way for me to have the comboBoxes in the new row always be filled?

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello,

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking through your post and I can say that this behavior is expected since the DataRecord is not created yet when you expand the XamComboEditor, and when you change the data in this Record, so I created a sample project for you with the functionality you want. Basically I handled the XamComboEditor’s EditModeStarting event and check if it is in the AddNewRow and if so I set its ItemsProvider Property to the DataSource.

    Feel free to write me if you have further questions.

    XamDataGridComboEditorBindingList.zip
Children
No Data