Unplanned
Last Updated: 15 Sep 2025 10:01 by Martin Ivanov
Martin Ivanov
Created on: 15 Sep 2025 10:01
Category: DataForm
Type: Bug Report
0
DataForm: Selection of an editable RadComboBox hosted in the EditTemplate gets cleared on commit edit

The selection a RadComboBox hosted in RadDataForm gets cleared on commit changes. This happens when the RadComboBox is added in the EditTemplate and its IsEditable is set to True. Committing the edit clears the TextBox of the ComboBox, which clears the selection.

To work this around, subscribe to the EditEnding event of RadDataForm and clear the DataContext of the RadComboBox element.

  private void RadDataForm_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
  {
      var dataForm = (RadDataForm)sender;
      var myField = dataForm.ChildrenOfType<DataFormDataField>().FirstOrDefault(df => df.Name == "myField");
      if (myField != null)
      {
          var comboBox = (RadComboBox)myField.Content;
          comboBox.DataContext = null;
      }
  }

0 comments