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;
}
}
Setting the Content property of DataFormDataField in the AutoGeneratingField event handler doesn't take any effect. The value should be displayed in the editor area of the data field.
Use manually defined data fields or use a dispatcher in the AutoGeneratingField event handler in order to delay the Content setting.
Setting the Content property of DataFormDataField doesn't take any effect. The value should be displayed in the editor are of the data field.
To work this around, you can use a custom data field.
public class CustomDataFormDataField : DataFormDataField
{
protected override Control GetControl()
{
if (this.Content != null)
{
return this.Content as Control;
}
return base.GetControl();
}
}
Good Morning,
It would be nice to have the possibility to choose if use DateTimePicker or DatePicker during the 'AutoGeneratingField' event.
Something like:
if (e.PropertyType.Equals(typeof(DateTime)))
{
e.DateTimeMode = ...RadDataForm.DateTimeMode.OnlyDate, //(or .DateTime)
}
Because overriding the 'DataFormField' content with a RadDateTimePicker is a little bit intricate especially for the binding/reference losing.
The control is very helpful to make fast user forms prototipe but in this case it lose all its convenience.
Thank you,
Best Regards,
Enrico
Reproducible only in .Net 4.5.
// Telerik.Windows.Controls.RadDataForm private void OnCurrentItemPropertyChanged(object sender, PropertyChangedEventArgs e) { if (sender != null) { // this causes the exception when called from non-UI thread // use Dispatcher.Invoke this.IsItemChanged = true; } Available in LIB version: 2017.2.529
RadDataForm should support DataAnnotations validation attributes defined in MetadataType partial classes.
Since the EditEnding and EditEnded don't always get thrown when the dataform leaves the edit mode, it would be helpful to have an event thrown whenever the dataform's Mode Changes. (this was already suggested an approved for the silverlight UI)
Allow the DataFormValidationSummary control to be used outside the context of RadDataForm.
The fix will be available with LIB version 2015.2.817.