I have a problem with a DataFormComboBoxField generated in code behind as suggested by your example
Here is the code for generate the field
e.DataField = GetComboField(columnFieldProp, e.DataField.DataMemberBinding);
e.DataField.Loaded +=
delegate
(
object
o, RoutedEventArgs eventArgs)
{
var field = o
as
DataFormComboBoxField;
foreach
(RadComboBox child
in
field.ChildrenOfType<RadComboBox>())
{
var comboBox = child;
if
(comboBox !=
null
)
comboBox.SetBinding(RadComboBox.SelectedValueProperty, e.DataField.DataMemberBinding);
}
};
private DataFormComboBoxField GetComboField(ToolColumnFieldProp columnFieldProp, Binding dataBinding)
{
DataFormComboBoxField combo = new DataFormComboBoxField();
combo.SelectedValuePath = columnFieldProp.ComboBoxSelectedPath;
combo.DisplayMemberPath = columnFieldProp.ComboBoxDisplayPath;
object context = Code.Utility.CreateInstance(columnFieldProp.ComboBoxAssemblyName, columnFieldProp.ComboBoxContextNameSpace);
combo.ItemsSource = Code.Utility.GetComboBoxItemSource(context);
combo.DataMemberBinding = dataBinding;
return combo;
}
XAML
<
telerik:RadDataForm
x:Name
=
"rdDataForm"
Header
=
"{Binding Title}"
CurrentItem
=
"{Binding Current, Mode=TwoWay}"
telerik:StyleManager.Theme
=
"Office_Blue"
ItemsSource
=
"{Binding List, Mode=TwoWay}"
AutoGeneratingField
=
"rdDataForm_AutoGeneratingField"
Grid.Row
=
"0"
AutoCommit
=
"False"
EditEnded
=
"rdDataForm_EditEnded"
DeletedItem
=
"rdDataForm_DeletedItem"
CommandButtonsVisibility
=
"Cancel,Commit"
LabelPosition
=
"Beside"
>
</
telerik:RadDataForm
>
The ComboBoxField is correctly generated, and correctly bound to selected value.
The problem is that when i go in edit mode, the combobox loses the selected value.
I have the same identical problem in the GridView that is bound to same collection.
Could you please help me?
Best regards
9 Answers, 1 is accepted
I have tried to reproduce the issue, but since I do not have all the necessary code, I was not able to get close to the scenario you described. Will it be possible to share a bit more code-snippets so that I could test it on my side ?
On the other hand, why do you need to work with the RadComboBox inside DataFormComboBoxField ? Why not using directly the field ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I can try to send you maybe via e-mail a little project, but it is part of a big and complicated project. Anyway if you need i will try to reproduce it.
Anyway, i'm not using rad combobox, but i have just created a DataFormComboBoxField
I am attaching a sample project here with a RadDataForm and a DataFormComboBoxField. Could you reproduce the same behavior on it by implementing your own custom code ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I have downloaded your project and i see that you are using the property dataField.IsComboboxEditable = true;
However, i do not have this property available in my version of silverlight control RadControls for Silverlight, v.2012.1.326.1050
your version is 1.4....
I am not able to download from your site this internal build.
Where i can find the download link?
(i do no want to use automatically upgrade from inside vs2010)
best regards
Indeed, we have included such a property in order to meet our customers' feature requests. 'IsComboboxEditable' property in contained in our internal builds. You can download them in your Telerik account.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thanks, it does not solve my issue but anyway upgrade controls to last version :-)
I will try to create a test project and then back to you
In read only mode, it is working fine, but when I switch to edit mode, the dataform combobox having the item source bound but loses it selected value. then when I go to next record in the grid, the previous record loses it's value associated to the dataform combobox.
​
I tried to reproduce a similar behavior as in your description, however I was unsuccessful. Could you please examine the attached example and let us know how it goes? Perhaps there are some differences between the attached sample and your scenario.
Regards,
Boris Penev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
But I have gone through and do not see I am missing anything.however I fixed it by adding a combobox inside the dataformdatafield which worked!!!
Thanks
kannan M