This is a migrated thread and some comments may be shown as answers.

DataFormComboBoxField issues

9 Answers 235 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
steve
Top achievements
Rank 1
steve asked on 29 Nov 2011, 01:11 PM
Hello Telerik Forum!

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

Sort by
0
Ivan Ivanov
Telerik team
answered on 02 Dec 2011, 04:13 PM
Hi Steve,

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
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Andreas
Top achievements
Rank 1
answered on 22 Feb 2012, 10:47 AM
Hello All!

It seems if we understood correctly, we have the same issue with the DataFormComboBoxField:

We bound it in this way:

                        <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>
We are able to select an Item in the ComboBox,
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
0
Andreas
Top achievements
Rank 1
answered on 22 Feb 2012, 04:01 PM
Hello!

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
0
Ivan Ivanov
Telerik team
answered on 24 Feb 2012, 01:13 PM
Hi 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
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
bbakermai
Top achievements
Rank 2
answered on 03 Apr 2012, 08:21 PM
I have the same issue trying to do this in an MVVM context. I am using a TextBox with a value converter in the ReadOnly mode template and a RadComboBox in the Edit/New template. Below is sample markup from the DataForm and its EditTemplate (the DataContext of the DataForm is the selected item from a RadDataGrid, and so the ItemsSource of the lookup data in the ComboBox must be connected to the parent DataContext, which is a ViewModel class). When I am editing and changing values, the value in the parent grid changes, but when I press either OK or Cancel from edit mode, the ComboBox's selected item's ValuePath returned to the grid's selected item is null, and so that column clears in the grid. The data source remains unaffected.

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:" 
ItemsSource
="{Binding ElementName=ChartOfAccountsControl, Path=DataContext.GLAccountClasses}"                                 DisplayMemberPath="AccountType" SelectedValuePath="GLAccountClass_ID" 
LabelPosition
="Above"                                DataMemberBinding="{Binding GLAccountClass_ID, Mode=TwoWay}"/>
I'd also like to know how to set the CommandButtonsVisibility to a combination of enum values...
0
Ivan Ivanov
Telerik team
answered on 04 Apr 2012, 12:26 PM
Hello Bob,

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
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Rick Feuer
Top achievements
Rank 1
answered on 23 Jul 2012, 05:01 PM

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" />

0
Vera
Telerik team
answered on 25 Jul 2012, 08:47 AM
Hi Rick,

 
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.

All the best,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Aleks
Top achievements
Rank 1
answered on 21 Sep 2012, 12:38 PM
I came across the same issue and ended up in this topic. Since I could not find a solution, I sent in a support ticket with a sample project.

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
Tags
DataForm
Asked by
steve
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Andreas
Top achievements
Rank 1
bbakermai
Top achievements
Rank 2
Rick Feuer
Top achievements
Rank 1
Vera
Telerik team
Aleks
Top achievements
Rank 1
Share this question
or