I am having some strange issues with the DataFormComboBoxField.
<telerik:DataFormComboBoxField Grid.Row=
"2"
Grid.Column=
"1"
SelectedValuePath=
"CategorieId"
DisplayMemberPath=
"Categorie"
ItemsSource=
"{Binding Categories, Source={StaticResource TEST}}"
DataMemberBinding=
"{Binding CategorieId, Mode=TwoWay}"
/>
Me
.Personen =
New
ObservableCollection(Of Personen)()
Me
.Categories =
New
ObservableCollection(Of PersoonCategorie)
My model is in attachement.
The datacontext of my view is Personen, and a statis resource 'TEST' for Categories
When i edit my form, the combobox loads correctly, also, when i change the value, it makes the changes in my RadGrid also properly.
However, once i end edit mode, and try to save, it gives me a NULL field.
So for some reason, the categorieId field DOES change (visible in my grid), but it makes itself go NULL value.
Any help on this please? I am in a hury to finish this project.
Thank you very much!
9 Answers, 1 is accepted
Please, excuse me for the late reply. I have tried to reproduce the described issue, testing it with our latest official version, but unfortunately without having any success. I am attaching my project for your reference. Would you please confirm whether I am not missing something? What exactly do you mean by saying: "However, once i end edit mode, and try to save, it gives me a NULL field."? Meanwhile, a running sample project that illustrates this problem would be highly appreciated, or at least some more info on your scenario.
All the best,
Ivan Ivanov
the Telerik team
It seems if we understood correctly, we have the same issue with the DataFormComboBoxField:
We bound it in this way:
We are able to select an Item in the ComboBox,<telerik:DataFormComboBoxField Grid.Column ="0" Grid.Row="4" Label="Dokumenttyp" ItemsSource="{Binding Path=DataContext.DocumentTypes,Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadDataForm}}}" DataMemberBinding="{Binding SelectedDocumentType, Mode=TwoWay}" DisplayMemberPath="Name" SelectedValuePath="Value"> </telerik:DataFormComboBoxField>
The SelectedDocumentType field is filled correctly with the "Value"
When pressing the "OK" Button immediate the bound property "SelectedDocumentType" is set to null...
Are we missing somthing in the binding?
Thanks!
Andreas Eibegger
after investigating a little bit more we found out that if we use different DataTemplates for the DataForm (For Readonly and Edit)
then it does not work, if we use only one DataTemplate it works.
BR!
Andreas
Would you please send us a runnable project that reproduces this issue, so that we could debug it on our side and give you an appropriate solution?
Regards,
Ivan Ivanov
the Telerik team
Here's the form itself:
<telerik:RadDataForm x:Name="radDataForm1"
CurrentItem="{Binding SelectedItem, ElementName=gridViewChartOfAccounts, Mode=TwoWay}"
Header="{Binding SelectedItem.Name, ElementName=gridViewChartOfAccounts}"
Background="Transparent"
AutoCommit="False"
AutoGenerateFields="False"
LabelPosition="Beside"
CommandButtonsVisibility="All"
UseLayoutRounding="True"
ReadOnlyTemplate="{StaticResource GLFormTemplate}"
EditTemplate="{StaticResource GLEditTemplate}"
NewItemTemplate="{StaticResource GLEditTemplate}">
And the DataFormComboBox from the Edit Template:
<telerik:DataFormComboBoxField Grid.Column="0" Grid.Row="2" Label="Account Type:"I'd also like to know how to set the CommandButtonsVisibility to a combination of enum values...
ItemsSource="{Binding ElementName=ChartOfAccountsControl, Path=DataContext.GLAccountClasses}" DisplayMemberPath="AccountType" SelectedValuePath="GLAccountClass_ID"
LabelPosition="Above" DataMemberBinding="{Binding GLAccountClass_ID, Mode=TwoWay}"/>
As it would be very difficult for us to prepare a full-blown project only having a XAML snippet, I would kindly ask you to send us a runnable sample, which we would be able to test on our side. As for the CommandButtonsVisibility property, the DataFormCommandButtonsVisibility type is a flagged enum, so that you can perform bitwise operations on them, like introduced in this article.
Regards,
Ivan Ivanov
the Telerik team
There is definately a bug using the DataFormComboField. I am having the exact issue as described above. The gender field actually gets changed, but my grid value that it is bound to get assigned null. If i use a dataformDataField in place, the problem does not exist. My field is a simple collection of strings. I am using the latest version of the wpf dll's
<telerik:DataFormComboBoxField DataMemberBinding="{Binding Gender,Mode=TwoWay}"
ItemsSource="{StaticResource Genders}"
Label="Gender"
IsEnabled="True" />
Unfortunately, we were not able to reproduce the reported problem using the details you provided. May I ask you to open a support ticket and to send a simple runnable project demonstrating the issue? Please take a look at this blog post for a reference on how to isolate it in a sample project.
Thank you in advance.
Vera
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Ivan provided a solution that worked. I am posting it here for anyone else that comes across the same issue and can not find the solution.
<
telerik:DataFormDataField
Label
=
"Role: "
>
<
telerik:RadComboBox
SelectedItem
=
"{Binding Role}"
ItemsSource
=
"{Binding ItemList, Source={StaticResource RoleDAL}}"
DisplayMemberPath
=
"Name"
/>
</
telerik:DataFormDataField
>
Sorry about grave digging...
-Aleks